From 53c905b99a5662b96ec70fd4b0850cda3a06f736 Mon Sep 17 00:00:00 2001 From: Paddy Carver Date: Mon, 19 Mar 2018 12:08:58 -0700 Subject: [PATCH] Back out the Set changes from #1217. PR #1217 mistakenly updated the Set logic when flattening backends, which caused some cascading errors and wasn't strictly necessary to resolve the issue at hand. This backs out those changes, and instead makes the smallest possible change to resolve the initial error, by separating the logic for flattening regional backends from the logic for flattening global backends. --- google/resource_compute_backend_service.go | 6 +++--- google/resource_compute_region_backend_service.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/resource_compute_backend_service.go b/google/resource_compute_backend_service.go index 507599faf5f..2d694dc3879 100644 --- a/google/resource_compute_backend_service.go +++ b/google/resource_compute_backend_service.go @@ -417,8 +417,8 @@ func expandBackends(configured []interface{}) ([]*compute.Backend, error) { return backends, nil } -func flattenBackends(backends []*compute.Backend) *schema.Set { - result := make([]interface{}, 0, len(backends)) +func flattenBackends(backends []*compute.Backend) []map[string]interface{} { + result := make([]map[string]interface{}, 0, len(backends)) for _, b := range backends { data := make(map[string]interface{}) @@ -433,7 +433,7 @@ func flattenBackends(backends []*compute.Backend) *schema.Set { result = append(result, data) } - return schema.NewSet(resourceGoogleComputeBackendServiceBackendHash, result) + return result } func expandBackendService(d *schema.ResourceData) (*compute.BackendService, error) { diff --git a/google/resource_compute_region_backend_service.go b/google/resource_compute_region_backend_service.go index 6525581e2a9..29804b6be01 100644 --- a/google/resource_compute_region_backend_service.go +++ b/google/resource_compute_region_backend_service.go @@ -339,8 +339,8 @@ func resourceGoogleComputeRegionBackendServiceBackendHash(v interface{}) int { return hashcode.String(buf.String()) } -func flattenRegionBackends(backends []*compute.Backend) *schema.Set { - result := make([]interface{}, 0, len(backends)) +func flattenRegionBackends(backends []*compute.Backend) []map[string]interface{} { + result := make([]map[string]interface{}, 0, len(backends)) for _, b := range backends { data := make(map[string]interface{}) @@ -350,5 +350,5 @@ func flattenRegionBackends(backends []*compute.Backend) *schema.Set { result = append(result, data) } - return schema.NewSet(resourceGoogleComputeRegionBackendServiceBackendHash, result) + return result }