Skip to content

Commit

Permalink
Modify cluster template to allow setting network tags on default-pool
Browse files Browse the repository at this point in the history
This adds the following tags to the default pool:
* the cluster_network_tag (gke-${var.name})
* the pool-specific network tag (gke-${var.name}-default-pool)
* user-specified tags from var.node_pools_tags["all"]\
* user-specified tags from var.node_pools_tags["default-pool"]
  • Loading branch information
tomasgareau committed Jan 12, 2022
1 parent 14a0536 commit c2dbc6f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ resource "google_container_cluster" "primary" {

service_account = lookup(var.node_pools[0], "service_account", local.service_account)

tags = concat(
lookup(local.node_pools_tags, "default_values", [true, true])[0] ? [local.cluster_network_tag] : [],
lookup(local.node_pools_tags, "default_values", [true, true])[1] ? ["${local.cluster_network_tag}-default-pool"] : [],
lookup(local.node_pools_tags, "all", []),
lookup(local.node_pools_tags, "default-pool", []),
)

dynamic "workload_metadata_config" {
for_each = local.cluster_node_metadata_config

Expand Down

0 comments on commit c2dbc6f

Please sign in to comment.