From f3ec846de73d5cf0e5057ee15e1dc06eef18d8c4 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 17 Jun 2020 12:41:42 -0700 Subject: [PATCH] send empty/false for import/export custom routes (#3661) (#6625) Signed-off-by: Modular Magician --- .changelog/3661.txt | 3 +++ google/resource_compute_network_peering_routes_config.go | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changelog/3661.txt diff --git a/.changelog/3661.txt b/.changelog/3661.txt new file mode 100644 index 00000000000..d3b845a6ead --- /dev/null +++ b/.changelog/3661.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: Allow updating `google_compute_network_peering_routes_config ` `import_custom_routes` and `export_custom_routes` to false +``` diff --git a/google/resource_compute_network_peering_routes_config.go b/google/resource_compute_network_peering_routes_config.go index b96697eda59..840326f09b8 100644 --- a/google/resource_compute_network_peering_routes_config.go +++ b/google/resource_compute_network_peering_routes_config.go @@ -85,13 +85,13 @@ func resourceComputeNetworkPeeringRoutesConfigCreate(d *schema.ResourceData, met exportCustomRoutesProp, err := expandNestedComputeNetworkPeeringRoutesConfigExportCustomRoutes(d.Get("export_custom_routes"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("export_custom_routes"); !isEmptyValue(reflect.ValueOf(exportCustomRoutesProp)) && (ok || !reflect.DeepEqual(v, exportCustomRoutesProp)) { + } else if v, ok := d.GetOkExists("export_custom_routes"); ok || !reflect.DeepEqual(v, exportCustomRoutesProp) { obj["exportCustomRoutes"] = exportCustomRoutesProp } importCustomRoutesProp, err := expandNestedComputeNetworkPeeringRoutesConfigImportCustomRoutes(d.Get("import_custom_routes"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("import_custom_routes"); !isEmptyValue(reflect.ValueOf(importCustomRoutesProp)) && (ok || !reflect.DeepEqual(v, importCustomRoutesProp)) { + } else if v, ok := d.GetOkExists("import_custom_routes"); ok || !reflect.DeepEqual(v, importCustomRoutesProp) { obj["importCustomRoutes"] = importCustomRoutesProp } @@ -208,13 +208,13 @@ func resourceComputeNetworkPeeringRoutesConfigUpdate(d *schema.ResourceData, met exportCustomRoutesProp, err := expandNestedComputeNetworkPeeringRoutesConfigExportCustomRoutes(d.Get("export_custom_routes"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("export_custom_routes"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, exportCustomRoutesProp)) { + } else if v, ok := d.GetOkExists("export_custom_routes"); ok || !reflect.DeepEqual(v, exportCustomRoutesProp) { obj["exportCustomRoutes"] = exportCustomRoutesProp } importCustomRoutesProp, err := expandNestedComputeNetworkPeeringRoutesConfigImportCustomRoutes(d.Get("import_custom_routes"), d, config) if err != nil { return err - } else if v, ok := d.GetOkExists("import_custom_routes"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, importCustomRoutesProp)) { + } else if v, ok := d.GetOkExists("import_custom_routes"); ok || !reflect.DeepEqual(v, importCustomRoutesProp) { obj["importCustomRoutes"] = importCustomRoutesProp }