diff --git a/.changelog/4580.txt b/.changelog/4580.txt new file mode 100644 index 00000000000..fb8a1989438 --- /dev/null +++ b/.changelog/4580.txt @@ -0,0 +1,3 @@ +```release-note:bug +container: Fixed updates on `export_custom_routes` and `import_custom_routes` in `google_compute_network_peering` +``` diff --git a/google/resource_compute_network_peering.go b/google/resource_compute_network_peering.go index 32b3fc08965..52e50c27f04 100644 --- a/google/resource_compute_network_peering.go +++ b/google/resource_compute_network_peering.go @@ -299,7 +299,7 @@ func expandNetworkPeering(d *schema.ResourceData) *compute.NetworkPeering { ImportCustomRoutes: d.Get("import_custom_routes").(bool), ExportSubnetRoutesWithPublicIp: d.Get("export_subnet_routes_with_public_ip").(bool), ImportSubnetRoutesWithPublicIp: d.Get("import_subnet_routes_with_public_ip").(bool), - ForceSendFields: []string{"ExportSubnetRoutesWithPublicIp"}, + ForceSendFields: []string{"ExportSubnetRoutesWithPublicIp", "ImportCustomRoutes", "ExportCustomRoutes"}, } } diff --git a/google/resource_compute_network_peering_test.go b/google/resource_compute_network_peering_test.go index 1dde189ec4f..25ebeaaf8c2 100644 --- a/google/resource_compute_network_peering_test.go +++ b/google/resource_compute_network_peering_test.go @@ -90,6 +90,15 @@ func TestAccComputeNetworkPeering_customRoutesUpdate(t *testing.T) { ImportStateVerify: true, ImportStateId: importId, }, + { + Config: testAccComputeNetworkPeeringDefaultCustomRoutes(primaryNetworkName, peeringName, suffix), + }, + { + ResourceName: "google_compute_network_peering.bar", + ImportState: true, + ImportStateVerify: true, + ImportStateId: importId, + }, }, }) }