Skip to content

Commit

Permalink
Add unit test for network rule allowing all traffic
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgordo committed Jul 19, 2023
1 parent ef5fbf2 commit 9fe5f63
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions sysdig/resource_sysdig_secure_rule_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func TestAccRuleNetwork(t *testing.T) {
{
Config: ruleNetworkWithUDP(rText()),
},
{
Config: ruleNetworkAllowingAllTraffic(rText()),
},
{
ResourceName: "sysdig_secure_rule_network.foo",
ImportState: true,
Expand Down Expand Up @@ -75,6 +78,28 @@ resource "sysdig_secure_rule_network" "foo" {
}`, name, name)
}

func ruleNetworkAllowingAllTraffic(name string) string {
return fmt.Sprintf(`
resource "sysdig_secure_rule_network" "foo" {
name = "TERRAFORM TEST %s" // ID
description = "TERRAFORM TEST %s"
tags = ["network", "cis"]
block_inbound = false
block_outbound = false
tcp {
matching = true // default
ports = [80, 443]
}
udp {
matching = true // default
ports = [80, 443]
}
}`, name, name)
}

func ruleNetworkWithoutTags(name string) string {
return fmt.Sprintf(`
resource "sysdig_secure_rule_network" "foo" {
Expand Down

0 comments on commit 9fe5f63

Please sign in to comment.