From 7f9f7201a8a07ece47f454aa82cfcdee44ef1a12 Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Tue, 7 Nov 2017 11:27:05 -0800 Subject: [PATCH] make setFields a list of regexps (#696) --- google/resource_container_cluster_test.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/google/resource_container_cluster_test.go b/google/resource_container_cluster_test.go index 5201b9b8..701fd4c8 100644 --- a/google/resource_container_cluster_test.go +++ b/google/resource_container_cluster_test.go @@ -595,10 +595,10 @@ func testAccCheckContainerClusterDestroy(s *terraform.State) error { return nil } -var setFields map[string]struct{} = map[string]struct{}{ - "additional_zones": struct{}{}, - "node_config.0.oauth_scopes": struct{}{}, - "node_pool.0.node_config.0.oauth_scopes": struct{}{}, +var setFields = []string{ + "additional_zones", + "node_config.0.oauth_scopes", + "node_pool.[0-9]*.node_config.0.oauth_scopes", } func testAccCheckContainerCluster(n string) resource.TestCheckFunc { @@ -756,8 +756,10 @@ func getResourceAttributes(n string, s *terraform.State) (map[string]string, err func checkMatch(attributes map[string]string, attr string, gcp interface{}) string { if gcpList, ok := gcp.([]string); ok { - if _, ok := setFields[attr]; ok { - return checkSetMatch(attributes, attr, gcpList) + for _, setField := range setFields { + if match, _ := regexp.MatchString(setField, attr); match { + return checkSetMatch(attributes, attr, gcpList) + } } return checkListMatch(attributes, attr, gcpList) }