mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Merge pull request #10117 from cblecker/f-gke-node-scopes
provider/google: Add support for scope aliases to google_container_cluster
This commit is contained in:
commit
a9f3060b6a
@ -223,10 +223,15 @@ func resourceContainerCluster() *schema.Resource {
|
||||
|
||||
"oauth_scopes": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
ForceNew: true,
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
StateFunc: func(v interface{}) string {
|
||||
return canonicalizeServiceScope(v.(string))
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -340,7 +345,7 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
|
||||
scopesList := v.([]interface{})
|
||||
scopes := []string{}
|
||||
for _, v := range scopesList {
|
||||
scopes = append(scopes, v.(string))
|
||||
scopes = append(scopes, canonicalizeServiceScope(v.(string)))
|
||||
}
|
||||
|
||||
cluster.NodeConfig.OauthScopes = scopes
|
||||
|
@ -43,6 +43,23 @@ func TestAccContainerCluster_withNodeConfig(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccContainerCluster_withNodeConfigScopeAlias(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckContainerClusterDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccContainerCluster_withNodeConfigScopeAlias,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckContainerClusterExists(
|
||||
"google_container_cluster.with_node_config_scope_alias"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccContainerCluster_network(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
@ -144,6 +161,24 @@ resource "google_container_cluster" "with_node_config" {
|
||||
}
|
||||
}`, acctest.RandString(10))
|
||||
|
||||
var testAccContainerCluster_withNodeConfigScopeAlias = fmt.Sprintf(`
|
||||
resource "google_container_cluster" "with_node_config_scope_alias" {
|
||||
name = "cluster-test-%s"
|
||||
zone = "us-central1-f"
|
||||
initial_node_count = 1
|
||||
|
||||
master_auth {
|
||||
username = "mr.yoda"
|
||||
password = "adoy.rm"
|
||||
}
|
||||
|
||||
node_config {
|
||||
machine_type = "g1-small"
|
||||
disk_size_gb = 15
|
||||
oauth_scopes = [ "compute-rw", "storage-ro", "logging-write", "monitoring" ]
|
||||
}
|
||||
}`, acctest.RandString(10))
|
||||
|
||||
var testAccContainerCluster_networkRef = fmt.Sprintf(`
|
||||
resource "google_compute_network" "container_network" {
|
||||
name = "container-net-%s"
|
||||
|
Loading…
Reference in New Issue
Block a user