@@ -23,15 +23,17 @@ func TestAccCloudStackEgressFirewall_basic(t *testing.T) {
2323 resource .TestCheckResourceAttr (
2424 "cloudstack_egress_firewall.foo" , "network" , CLOUDSTACK_NETWORK_1 ),
2525 resource .TestCheckResourceAttr (
26- "cloudstack_egress_firewall.foo" , "rule.1702320581.source_cidr" , "10.0.0.0/24" ),
26+ "cloudstack_egress_firewall.foo" ,
27+ "rule.411689741.source_cidr" ,
28+ CLOUDSTACK_NETWORK_1_IPADDRESS + "/32" ),
2729 resource .TestCheckResourceAttr (
28- "cloudstack_egress_firewall.foo" , "rule.1702320581 .protocol" , "tcp" ),
30+ "cloudstack_egress_firewall.foo" , "rule.411689741 .protocol" , "tcp" ),
2931 resource .TestCheckResourceAttr (
30- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.#" , "2" ),
32+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.#" , "2" ),
3133 resource .TestCheckResourceAttr (
32- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1209010669" , "1000-2000" ),
34+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.1209010669" , "1000-2000" ),
3335 resource .TestCheckResourceAttr (
34- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1889509032" , "80" ),
36+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.1889509032" , "80" ),
3537 ),
3638 },
3739 },
@@ -49,19 +51,21 @@ func TestAccCloudStackEgressFirewall_update(t *testing.T) {
4951 Check : resource .ComposeTestCheckFunc (
5052 testAccCheckCloudStackEgressFirewallRulesExist ("cloudstack_egress_firewall.foo" ),
5153 resource .TestCheckResourceAttr (
52- "cloudstack_egress_firewall.foo" , "ipaddress " , CLOUDSTACK_NETWORK_1 ),
54+ "cloudstack_egress_firewall.foo" , "network " , CLOUDSTACK_NETWORK_1 ),
5355 resource .TestCheckResourceAttr (
5456 "cloudstack_egress_firewall.foo" , "rule.#" , "1" ),
5557 resource .TestCheckResourceAttr (
56- "cloudstack_egress_firewall.foo" , "rule.1702320581.source_cidr" , "10.0.0.0/24" ),
58+ "cloudstack_egress_firewall.foo" ,
59+ "rule.411689741.source_cidr" ,
60+ CLOUDSTACK_NETWORK_1_IPADDRESS + "/32" ),
5761 resource .TestCheckResourceAttr (
58- "cloudstack_egress_firewall.foo" , "rule.1702320581 .protocol" , "tcp" ),
62+ "cloudstack_egress_firewall.foo" , "rule.411689741 .protocol" , "tcp" ),
5963 resource .TestCheckResourceAttr (
60- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.#" , "2" ),
64+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.#" , "2" ),
6165 resource .TestCheckResourceAttr (
62- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1209010669" , "1000-2000" ),
66+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.1209010669" , "1000-2000" ),
6367 resource .TestCheckResourceAttr (
64- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1889509032" , "80" ),
68+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.1889509032" , "80" ),
6569 ),
6670 },
6771
@@ -70,29 +74,31 @@ func TestAccCloudStackEgressFirewall_update(t *testing.T) {
7074 Check : resource .ComposeTestCheckFunc (
7175 testAccCheckCloudStackEgressFirewallRulesExist ("cloudstack_egress_firewall.foo" ),
7276 resource .TestCheckResourceAttr (
73- "cloudstack_egress_firewall.foo" , "ipaddress " , CLOUDSTACK_NETWORK_1 ),
77+ "cloudstack_egress_firewall.foo" , "network " , CLOUDSTACK_NETWORK_1 ),
7478 resource .TestCheckResourceAttr (
7579 "cloudstack_egress_firewall.foo" , "rule.#" , "2" ),
7680 resource .TestCheckResourceAttr (
77- "cloudstack_egress_firewall.foo" , "rule.1702320581.source_cidr" , "10.0.0.0/24" ),
78- resource . TestCheckResourceAttr (
79- "cloudstack_egress_firewall.foo" , "rule.1702320581.protocol" , "tcp " ),
81+ "cloudstack_egress_firewall.foo" ,
82+ "rule.411689741.source_cidr" ,
83+ CLOUDSTACK_NETWORK_1_IPADDRESS + "/32 " ),
8084 resource .TestCheckResourceAttr (
81- "cloudstack_egress_firewall.foo" , "rule.1702320581.ports.# " , "2 " ),
85+ "cloudstack_egress_firewall.foo" , "rule.411689741.protocol " , "tcp " ),
8286 resource .TestCheckResourceAttr (
83- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1209010669 " , "1000-2000 " ),
87+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.# " , "2 " ),
8488 resource .TestCheckResourceAttr (
85- "cloudstack_egress_firewall.foo" , "rule.1702320581 .ports.1889509032 " , "80 " ),
89+ "cloudstack_egress_firewall.foo" , "rule.411689741 .ports.1209010669 " , "1000-2000 " ),
8690 resource .TestCheckResourceAttr (
87- "cloudstack_egress_firewall.foo" , "rule.3779782959.source_cidr " , "172.16.100.0/24 " ),
91+ "cloudstack_egress_firewall.foo" , "rule.411689741.ports.1889509032 " , "80 " ),
8892 resource .TestCheckResourceAttr (
89- "cloudstack_egress_firewall.foo" , "rule.3779782959.protocol" , "tcp" ),
93+ "cloudstack_egress_firewall.foo" ,
94+ "rule.845479598.source_cidr" ,
95+ CLOUDSTACK_NETWORK_1_IPADDRESS + "/32" ),
9096 resource .TestCheckResourceAttr (
91- "cloudstack_egress_firewall.foo" , "rule.3779782959.ports.# " , "2 " ),
97+ "cloudstack_egress_firewall.foo" , "rule.845479598.protocol " , "tcp " ),
9298 resource .TestCheckResourceAttr (
93- "cloudstack_egress_firewall.foo" , "rule.3779782959 .ports.1889509032 " , "80 " ),
99+ "cloudstack_egress_firewall.foo" , "rule.845479598 .ports.# " , "1 " ),
94100 resource .TestCheckResourceAttr (
95- "cloudstack_egress_firewall.foo" , "rule.3779782959 .ports.3638101695" , "443" ),
101+ "cloudstack_egress_firewall.foo" , "rule.845479598 .ports.3638101695" , "443" ),
96102 ),
97103 },
98104 },
@@ -162,7 +168,7 @@ func testAccCheckCloudStackEgressFirewallDestroy(s *terraform.State) error {
162168
163169var testAccCloudStackEgressFirewall_basic = fmt .Sprintf (`
164170resource "cloudstack_egress_firewall" "foo" {
165- ipaddress = "%s"
171+ network = "%s"
166172
167173 rule {
168174 source_cidr = "%s/32"
@@ -175,13 +181,20 @@ resource "cloudstack_egress_firewall" "foo" {
175181
176182var testAccCloudStackEgressFirewall_update = fmt .Sprintf (`
177183resource "cloudstack_egress_firewall" "foo" {
178- ipaddress = "%s"
184+ network = "%s"
185+
186+ rule {
187+ source_cidr = "%s/32"
188+ protocol = "tcp"
189+ ports = ["80", "1000-2000"]
190+ }
179191
180192 rule {
181193 source_cidr = "%s/32"
182194 protocol = "tcp"
183- ports = ["80", " 443", 1000-2000 "]
195+ ports = ["443"]
184196 }
185197}` ,
186198 CLOUDSTACK_NETWORK_1 ,
199+ CLOUDSTACK_NETWORK_1_IPADDRESS ,
187200 CLOUDSTACK_NETWORK_1_IPADDRESS )
0 commit comments