mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-03 08:42:39 +00:00
Merge pull request #7 from unguiculus/feature/tags_labels
Add support for labels and tags on GKE node_config
This commit is contained in:
commit
dcb564b23d
|
@ -284,6 +284,20 @@ func resourceContainerCluster() *schema.Resource {
|
|||
Computed: true,
|
||||
ForceNew: true,
|
||||
},
|
||||
|
||||
"labels": &schema.Schema{
|
||||
Type: schema.TypeMap,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Elem: schema.TypeString,
|
||||
},
|
||||
|
||||
"tags": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
ForceNew: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -468,6 +482,23 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
|
|||
if v, ok = nodeConfig["image_type"]; ok {
|
||||
cluster.NodeConfig.ImageType = v.(string)
|
||||
}
|
||||
|
||||
if v, ok = nodeConfig["labels"]; ok {
|
||||
m := make(map[string]string)
|
||||
for k, val := range v.(map[string]interface{}) {
|
||||
m[k] = val.(string)
|
||||
}
|
||||
cluster.NodeConfig.Labels = m
|
||||
}
|
||||
|
||||
if v, ok := nodeConfig["tags"]; ok {
|
||||
tagsList := v.([]interface{})
|
||||
tags := []string{}
|
||||
for _, v := range tagsList {
|
||||
tags = append(tags, v.(string))
|
||||
}
|
||||
cluster.NodeConfig.Tags = tags
|
||||
}
|
||||
}
|
||||
|
||||
nodePoolsCount := d.Get("node_pool.#").(int)
|
||||
|
@ -683,6 +714,8 @@ func flattenClusterNodeConfig(c *container.NodeConfig) []map[string]interface{}
|
|||
"service_account": c.ServiceAccount,
|
||||
"metadata": c.Metadata,
|
||||
"image_type": c.ImageType,
|
||||
"labels": c.Labels,
|
||||
"tags": c.Tags,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -268,6 +268,8 @@ func testAccCheckContainerCluster(n string) resource.TestCheckFunc {
|
|||
{"node_config.0.service_account", cluster.NodeConfig.ServiceAccount},
|
||||
{"node_config.0.metadata", cluster.NodeConfig.Metadata},
|
||||
{"node_config.0.image_type", cluster.NodeConfig.ImageType},
|
||||
{"node_config.0.labels", cluster.NodeConfig.Labels},
|
||||
{"node_config.0.tags", cluster.NodeConfig.Tags},
|
||||
{"node_version", cluster.CurrentNodeVersion},
|
||||
}
|
||||
|
||||
|
@ -466,6 +468,10 @@ resource "google_container_cluster" "with_node_config" {
|
|||
foo = "bar"
|
||||
}
|
||||
image_type = "CONTAINER_VM"
|
||||
labels {
|
||||
foo = "bar"
|
||||
}
|
||||
tags = ["foo", "bar"]
|
||||
}
|
||||
}`, acctest.RandString(10))
|
||||
|
||||
|
|
|
@ -40,6 +40,12 @@ resource "google_container_cluster" "primary" {
|
|||
"https://www.googleapis.com/auth/logging.write",
|
||||
"https://www.googleapis.com/auth/monitoring",
|
||||
]
|
||||
|
||||
labels {
|
||||
foo = "bar"
|
||||
}
|
||||
|
||||
tags = ["foo", "bar"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -137,6 +143,11 @@ which the cluster's instances are launched
|
|||
|
||||
* `image_type` - (Optional) The image type to use for this node.
|
||||
|
||||
* `labels` - (Optional) The Kubernetes labels (key/value pairs) to be applied to each node.
|
||||
|
||||
* `tags` - (Optional) The list of instance tags applied to all nodes. Tags are used to identify
|
||||
valid sources or targets for network firewalls.
|
||||
|
||||
**Addons Config** supports the following addons:
|
||||
|
||||
* `http_load_balancing` - (Optional) The status of the HTTP Load Balancing
|
||||
|
|
Loading…
Reference in New Issue
Block a user