@@ -288,6 +288,42 @@ func TestAccComputeNetworkFirewallSecurityProfileGroupDiffsuppress(t *testing.T)
288288 })
289289}
290290
291+ func TestAccComputeNetworkFirewallPolicyRule_disable_enable (t * testing.T ) {
292+ t .Parallel ()
293+
294+ context := map [string ]interface {}{
295+ "random_suffix" : acctest .RandString (t , 10 ),
296+ }
297+
298+ acctest .VcrTest (t , resource.TestCase {
299+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
300+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
301+ Steps : []resource.TestStep {
302+ {
303+ Config : testAccComputeNetworkFirewallPolicyRule_disabled (context , true ),
304+ },
305+ {
306+ ResourceName : "google_compute_network_firewall_policy_rule.fw_policy_rule" ,
307+ ImportState : true ,
308+ ImportStateVerify : true ,
309+ ImportStateVerifyIgnore : []string {"firewall_policy" },
310+ },
311+ {
312+ Config : testAccComputeNetworkFirewallPolicyRule_disabled (context , false ),
313+ Check : resource .ComposeTestCheckFunc (
314+ resource .TestCheckResourceAttr ("google_compute_network_firewall_policy_rule.fw_policy_rule" , "disabled" , "false" ),
315+ ),
316+ },
317+ {
318+ ResourceName : "google_compute_network_firewall_policy_rule.fw_policy_rule" ,
319+ ImportState : true ,
320+ ImportStateVerify : true ,
321+ ImportStateVerifyIgnore : []string {"firewall_policy" },
322+ },
323+ },
324+ })
325+ }
326+
291327func testAccComputeNetworkFirewallPolicyRule_secureTags (context map [string ]interface {}) string {
292328 return acctest .Nprintf (`
293329resource "google_network_security_address_group" "basic_global_networksecurity_address_group" {
@@ -1028,3 +1064,33 @@ resource "google_compute_network_firewall_policy_rule" "dest_test" {
10281064
10291065` , context )
10301066}
1067+
1068+ func testAccComputeNetworkFirewallPolicyRule_disabled (context map [string ]interface {}, disabled bool ) string {
1069+ context ["disabled" ] = fmt .Sprintf ("%t" , disabled )
1070+ return acctest .Nprintf (`
1071+ resource "google_compute_network" "network" {
1072+ name = "tf-test-%{random_suffix}"
1073+ auto_create_subnetworks = false
1074+ }
1075+
1076+ resource "google_compute_network_firewall_policy" "fw_policy" {
1077+ name = "tf-test-policy-%{random_suffix}"
1078+ }
1079+
1080+ resource "google_compute_network_firewall_policy_rule" "fw_policy_rule" {
1081+ firewall_policy = google_compute_network_firewall_policy.fw_policy.id
1082+ priority = 1000
1083+ action = "allow"
1084+ direction = "EGRESS"
1085+ disabled = %{disabled}
1086+ match {
1087+ dest_ip_ranges = ["35.235.240.0/20"]
1088+
1089+ layer4_configs {
1090+ ip_protocol = "tcp"
1091+ ports = [22]
1092+ }
1093+ }
1094+ }
1095+ ` , context )
1096+ }
0 commit comments