Skip to content

Commit

Permalink
Docs: Improve documentation for hcloud_firewall resource to include i…
Browse files Browse the repository at this point in the history
…nformation about port ranges and the `any` keyword (#381)

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
  • Loading branch information
LKaemmerling committed Jun 18, 2021
1 parent e775c36 commit 80ee6fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions internal/e2etests/firewall/resource_test.go
Expand Up @@ -31,6 +31,12 @@ func TestFirewallResource_Basic(t *testing.T) {
DestinationIPs: []string{"0.0.0.0/0", "::/0"},
Port: "80",
},
{
Direction: "in",
Protocol: "udp",
DestinationIPs: []string{"0.0.0.0/0", "::/0"},
Port: "any",
},
})

updated := firewall.NewRData(t, "basic-firewall", []firewall.RDataRule{
Expand All @@ -46,6 +52,12 @@ func TestFirewallResource_Basic(t *testing.T) {
DestinationIPs: []string{"0.0.0.0/0", "::/0"},
Port: "443",
},
{
Direction: "in",
Protocol: "udp",
DestinationIPs: []string{"0.0.0.0/0", "::/0"},
Port: "any",
},
})
updated.SetRName(res.RName())
tmplMan := testtemplate.Manager{}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/firewall.html.md
Expand Up @@ -42,7 +42,7 @@ resource "hcloud_server" "node1" {
`rule` support the following fields:
- `direction` - (Required, string) Direction of the Firewall Rule. `in`
- `protocol` - (Required, string) Protocol of the Firewall Rule. `tcp`, `icmp`, `udp`, `gre`, `esp`
- `port` - (Required, string) Port of the Firewall Rule. Required when `protocol` is `tcp` or `udp`
- `port` - (Required, string) Port of the Firewall Rule. Required when `protocol` is `tcp` or `udp`. You can use `any` to allow all ports for the specific protocol. Port ranges are also possible: `80:85` allows all ports between 80 and 85.
- `source_ips` - (Required, List) List of CIDRs that are allowed within this Firewall Rule

## Attributes Reference
Expand Down

0 comments on commit 80ee6fa

Please sign in to comment.