Skip to content

Commit

Permalink
Back out the Set changes from #1217.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paddycarver committed Mar 19, 2018
1 parent c07cb1c commit 53c905b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions google/resource_compute_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand All @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions google/resource_compute_region_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand All @@ -350,5 +350,5 @@ func flattenRegionBackends(backends []*compute.Backend) *schema.Set {
result = append(result, data)
}

return schema.NewSet(resourceGoogleComputeRegionBackendServiceBackendHash, result)
return result
}

0 comments on commit 53c905b

Please sign in to comment.