mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-06 18:51:13 +00:00
make setFields a list of regexps (#696)
This commit is contained in:
parent
205b093701
commit
7f9f7201a8
@ -595,10 +595,10 @@ func testAccCheckContainerClusterDestroy(s *terraform.State) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var setFields map[string]struct{} = map[string]struct{}{
|
var setFields = []string{
|
||||||
"additional_zones": struct{}{},
|
"additional_zones",
|
||||||
"node_config.0.oauth_scopes": struct{}{},
|
"node_config.0.oauth_scopes",
|
||||||
"node_pool.0.node_config.0.oauth_scopes": struct{}{},
|
"node_pool.[0-9]*.node_config.0.oauth_scopes",
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckContainerCluster(n string) resource.TestCheckFunc {
|
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 {
|
func checkMatch(attributes map[string]string, attr string, gcp interface{}) string {
|
||||||
if gcpList, ok := gcp.([]string); ok {
|
if gcpList, ok := gcp.([]string); ok {
|
||||||
if _, ok := setFields[attr]; ok {
|
for _, setField := range setFields {
|
||||||
return checkSetMatch(attributes, attr, gcpList)
|
if match, _ := regexp.MatchString(setField, attr); match {
|
||||||
|
return checkSetMatch(attributes, attr, gcpList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return checkListMatch(attributes, attr, gcpList)
|
return checkListMatch(attributes, attr, gcpList)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user