Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Firewall

platform_firewall is a security group. Nested rule blocks are the inbound and outbound rules. An update replaces the whole rule set.

resource "platform_firewall" "web" {
name = "web"
description = "HTTPS and SSH"
rule {
direction = "in"
protocol = "tcp"
port_range = "22"
remote = "0.0.0.0/0"
}
rule {
direction = "in"
protocol = "tcp"
port_range = "443"
remote = "0.0.0.0/0"
}
}

The server normalizes an omitted action to accept, so leaving action out of the configuration is not drift.

NameRequiredNotes
nameyesDisplay name
descriptionnoComputed if omitted
rulenoNested block, repeatable
NameRequiredNotes
directionyesFor example in
protocolyesFor example tcp
port_rangenoFor example 22 or 80-443
remotenoCIDR, for example 0.0.0.0/0
descriptionnoPer-rule note
actionnoComputed if omitted (server default accept)
NameNotes
idPlatform id

This resource creates, updates rules, and deletes the firewall. Attach and detach to an instance are API actions, not attributes on this resource.

Terminal window
terraform import platform_firewall.web fw_…

Read rebuilds the rule blocks from the API.