mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-03 08:42:39 +00:00
Add sort on google_container_cluster auth_scopes (#506)
* replalce TypeList by TypeSet * Add migrate function and test * CORRECT * remove migrate * fix tests
This commit is contained in:
parent
ec008135ce
commit
1f954e0131
|
@ -38,7 +38,7 @@ var schemaNodeConfig = &schema.Schema{
|
|||
},
|
||||
|
||||
"oauth_scopes": {
|
||||
Type: schema.TypeList,
|
||||
Type: schema.TypeSet,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
|
@ -48,6 +48,7 @@ var schemaNodeConfig = &schema.Schema{
|
|||
return canonicalizeServiceScope(v.(string))
|
||||
},
|
||||
},
|
||||
Set: stringScopeHashcode,
|
||||
},
|
||||
|
||||
"service_account": {
|
||||
|
@ -113,11 +114,11 @@ func expandNodeConfig(v interface{}) *container.NodeConfig {
|
|||
nc.LocalSsdCount = int64(v.(int))
|
||||
}
|
||||
|
||||
if v, ok := nodeConfig["oauth_scopes"]; ok {
|
||||
scopesList := v.([]interface{})
|
||||
scopes := []string{}
|
||||
for _, v := range scopesList {
|
||||
scopes = append(scopes, canonicalizeServiceScope(v.(string)))
|
||||
if scopes, ok := nodeConfig["oauth_scopes"]; ok {
|
||||
scopesSet := scopes.(*schema.Set)
|
||||
scopes := make([]string, scopesSet.Len())
|
||||
for i, scope := range scopesSet.List() {
|
||||
scopes[i] = canonicalizeServiceScope(scope.(string))
|
||||
}
|
||||
|
||||
nc.OauthScopes = scopes
|
||||
|
@ -181,7 +182,7 @@ func flattenNodeConfig(c *container.NodeConfig) []map[string]interface{} {
|
|||
})
|
||||
|
||||
if len(c.OauthScopes) > 0 {
|
||||
config[0]["oauth_scopes"] = c.OauthScopes
|
||||
config[0]["oauth_scopes"] = schema.NewSet(stringScopeHashcode, convertStringArrToInterface(c.OauthScopes))
|
||||
}
|
||||
|
||||
return config
|
||||
|
|
|
@ -535,7 +535,9 @@ func testAccCheckContainerClusterDestroy(s *terraform.State) error {
|
|||
}
|
||||
|
||||
var setFields map[string]struct{} = map[string]struct{}{
|
||||
"additional_zones": struct{}{},
|
||||
"additional_zones": struct{}{},
|
||||
"node_config.0.oauth_scopes": struct{}{},
|
||||
"node_pool.0.node_config.0.oauth_scopes": struct{}{},
|
||||
}
|
||||
|
||||
func testAccCheckContainerCluster(n string) resource.TestCheckFunc {
|
||||
|
@ -991,10 +993,10 @@ resource "google_container_cluster" "with_node_config" {
|
|||
disk_size_gb = 15
|
||||
local_ssd_count = 1
|
||||
oauth_scopes = [
|
||||
"https://www.googleapis.com/auth/monitoring",
|
||||
"https://www.googleapis.com/auth/compute",
|
||||
"https://www.googleapis.com/auth/devstorage.read_only",
|
||||
"https://www.googleapis.com/auth/logging.write",
|
||||
"https://www.googleapis.com/auth/monitoring"
|
||||
"https://www.googleapis.com/auth/logging.write"
|
||||
]
|
||||
service_account = "default"
|
||||
metadata {
|
||||
|
|
Loading…
Reference in New Issue
Block a user