force send a bunch more fields in firewall

This commit is contained in:
Dana Hoffman 2018-07-16 18:46:05 -07:00
parent 24396c9fea
commit 335ccae604
2 changed files with 25 additions and 1 deletions

View File

@ -418,6 +418,6 @@ func resourceFirewall(d *schema.ResourceData, meta interface{}) (*computeBeta.Fi
SourceServiceAccounts: convertStringSet(d.Get("source_service_accounts").(*schema.Set)),
TargetServiceAccounts: convertStringSet(d.Get("target_service_accounts").(*schema.Set)),
Disabled: d.Get("disabled").(bool),
ForceSendFields: []string{"Disabled"},
ForceSendFields: []string{"Disabled", "Allowed", "Denied", "SourceRanges", "SourceTags", "DestinationRanges", "TargetTags"},
}, nil
}

View File

@ -63,6 +63,11 @@ func TestAccComputeFirewall_update(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
Config: testAccComputeFirewall_update(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
@ -73,6 +78,24 @@ func TestAccComputeFirewall_update(t *testing.T) {
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
},
resource.TestStep{
Config: testAccComputeFirewall_basic(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
testAccCheckComputeFirewallExists(
"google_compute_firewall.foobar", &firewall),
testAccCheckComputeFirewallApiVersion(&firewall),
),
},
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
@ -454,6 +477,7 @@ func testAccComputeFirewall_update(network, firewall string) string {
description = "Resource created for Terraform acceptance testing"
network = "${google_compute_network.foobar.self_link}"
source_tags = ["foo"]
target_tags = ["bar"]
allow {
protocol = "tcp"