diff --git a/README.md b/README.md index 0e5cf2eaf..08fe28c75 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ Then perform the following commands on the root folder: | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 4758f9e6f..68476199f 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -696,6 +696,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/autogen/main/variables.tf.tmpl b/autogen/main/variables.tf.tmpl index 043d236c3..c39235a0f 100644 --- a/autogen/main/variables.tf.tmpl +++ b/autogen/main/variables.tf.tmpl @@ -171,6 +171,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/autogen/main/variables_defaults.tf.tmpl b/autogen/main/variables_defaults.tf.tmpl index 1706713eb..d98c96287 100644 --- a/autogen/main/variables_defaults.tf.tmpl +++ b/autogen/main/variables_defaults.tf.tmpl @@ -35,6 +35,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/autogen/main/versions.tf.tmpl b/autogen/main/versions.tf.tmpl index 6a0f85719..70f2791b6 100644 --- a/autogen/main/versions.tf.tmpl +++ b/autogen/main/versions.tf.tmpl @@ -24,7 +24,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" @@ -38,7 +38,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/autogen/safer-cluster/main.tf.tmpl b/autogen/safer-cluster/main.tf.tmpl index 112c28739..b647a7014 100644 --- a/autogen/safer-cluster/main.tf.tmpl +++ b/autogen/safer-cluster/main.tf.tmpl @@ -86,12 +86,13 @@ module "gke" { // If removing the default node pool, initial_node_count should be at least 1. initial_node_count = (var.initial_node_count == 0) ? 1 : var.initial_node_count - node_pools = var.node_pools - windows_node_pools = var.windows_node_pools - node_pools_labels = var.node_pools_labels - node_pools_metadata = var.node_pools_metadata - node_pools_taints = var.node_pools_taints - node_pools_tags = var.node_pools_tags + node_pools = var.node_pools + windows_node_pools = var.windows_node_pools + node_pools_labels = var.node_pools_labels + node_pools_resource_labels = var.node_pools_resource_labels + node_pools_metadata = var.node_pools_metadata + node_pools_taints = var.node_pools_taints + node_pools_tags = var.node_pools_tags node_pools_oauth_scopes = var.node_pools_oauth_scopes diff --git a/autogen/safer-cluster/variables.tf.tmpl b/autogen/safer-cluster/variables.tf.tmpl index 9fd29370f..a357cbe24 100644 --- a/autogen/safer-cluster/variables.tf.tmpl +++ b/autogen/safer-cluster/variables.tf.tmpl @@ -168,6 +168,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/cluster.tf b/cluster.tf index 85cac2f85..eeccd2b2a 100644 --- a/cluster.tf +++ b/cluster.tf @@ -384,6 +384,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -538,6 +542,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-autopilot-private-cluster/versions.tf b/modules/beta-autopilot-private-cluster/versions.tf index d2c56938f..8aa8b5015 100644 --- a/modules/beta-autopilot-private-cluster/versions.tf +++ b/modules/beta-autopilot-private-cluster/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/beta-autopilot-public-cluster/versions.tf b/modules/beta-autopilot-public-cluster/versions.tf index f33d10d73..4660c27a4 100644 --- a/modules/beta-autopilot-public-cluster/versions.tf +++ b/modules/beta-autopilot-public-cluster/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/beta-private-cluster-update-variant/README.md b/modules/beta-private-cluster-update-variant/README.md index e1803a617..0a62257bd 100644 --- a/modules/beta-private-cluster-update-variant/README.md +++ b/modules/beta-private-cluster-update-variant/README.md @@ -240,6 +240,7 @@ Then perform the following commands on the root folder: | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 3af2360b3..e9cbce191 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -604,6 +604,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -811,6 +815,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-private-cluster-update-variant/variables.tf b/modules/beta-private-cluster-update-variant/variables.tf index e2769759d..e51ecb34d 100644 --- a/modules/beta-private-cluster-update-variant/variables.tf +++ b/modules/beta-private-cluster-update-variant/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/beta-private-cluster-update-variant/variables_defaults.tf b/modules/beta-private-cluster-update-variant/variables_defaults.tf index cc65ac9e8..e4f300477 100644 --- a/modules/beta-private-cluster-update-variant/variables_defaults.tf +++ b/modules/beta-private-cluster-update-variant/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/beta-private-cluster-update-variant/versions.tf b/modules/beta-private-cluster-update-variant/versions.tf index 309dfee7b..41d7da6de 100644 --- a/modules/beta-private-cluster-update-variant/versions.tf +++ b/modules/beta-private-cluster-update-variant/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/beta-private-cluster/README.md b/modules/beta-private-cluster/README.md index 1e0b0c655..96bb1ca0c 100644 --- a/modules/beta-private-cluster/README.md +++ b/modules/beta-private-cluster/README.md @@ -218,6 +218,7 @@ Then perform the following commands on the root folder: | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 0f34bed4b..0040d5d9b 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -510,6 +510,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -716,6 +720,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-private-cluster/variables.tf b/modules/beta-private-cluster/variables.tf index e2769759d..e51ecb34d 100644 --- a/modules/beta-private-cluster/variables.tf +++ b/modules/beta-private-cluster/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/beta-private-cluster/variables_defaults.tf b/modules/beta-private-cluster/variables_defaults.tf index cc65ac9e8..e4f300477 100644 --- a/modules/beta-private-cluster/variables_defaults.tf +++ b/modules/beta-private-cluster/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/beta-private-cluster/versions.tf b/modules/beta-private-cluster/versions.tf index 1484f8db3..1ebe76708 100644 --- a/modules/beta-private-cluster/versions.tf +++ b/modules/beta-private-cluster/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/beta-public-cluster-update-variant/README.md b/modules/beta-public-cluster-update-variant/README.md index 141d34829..4cbb6b77b 100644 --- a/modules/beta-public-cluster-update-variant/README.md +++ b/modules/beta-public-cluster-update-variant/README.md @@ -229,6 +229,7 @@ Then perform the following commands on the root folder: | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 449423de4..09938b2cb 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -585,6 +585,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -792,6 +796,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-public-cluster-update-variant/variables.tf b/modules/beta-public-cluster-update-variant/variables.tf index e0f03aacd..2de66dd1b 100644 --- a/modules/beta-public-cluster-update-variant/variables.tf +++ b/modules/beta-public-cluster-update-variant/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/beta-public-cluster-update-variant/variables_defaults.tf b/modules/beta-public-cluster-update-variant/variables_defaults.tf index cc65ac9e8..e4f300477 100644 --- a/modules/beta-public-cluster-update-variant/variables_defaults.tf +++ b/modules/beta-public-cluster-update-variant/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/beta-public-cluster-update-variant/versions.tf b/modules/beta-public-cluster-update-variant/versions.tf index 5239940eb..c73ab8d4c 100644 --- a/modules/beta-public-cluster-update-variant/versions.tf +++ b/modules/beta-public-cluster-update-variant/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/beta-public-cluster/README.md b/modules/beta-public-cluster/README.md index cd197ff2f..f95eb9984 100644 --- a/modules/beta-public-cluster/README.md +++ b/modules/beta-public-cluster/README.md @@ -207,6 +207,7 @@ Then perform the following commands on the root folder: | node\_pools\_linux\_node\_configs\_sysctls | Map of maps containing linux node config sysctls by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 7854d50db..8ced17225 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -491,6 +491,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -697,6 +701,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/beta-public-cluster/variables.tf b/modules/beta-public-cluster/variables.tf index e0f03aacd..2de66dd1b 100644 --- a/modules/beta-public-cluster/variables.tf +++ b/modules/beta-public-cluster/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/beta-public-cluster/variables_defaults.tf b/modules/beta-public-cluster/variables_defaults.tf index cc65ac9e8..e4f300477 100644 --- a/modules/beta-public-cluster/variables_defaults.tf +++ b/modules/beta-public-cluster/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/beta-public-cluster/versions.tf b/modules/beta-public-cluster/versions.tf index 637074ea1..b8779bc6f 100644 --- a/modules/beta-public-cluster/versions.tf +++ b/modules/beta-public-cluster/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google-beta = { source = "hashicorp/google-beta" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/private-cluster-update-variant/README.md b/modules/private-cluster-update-variant/README.md index 4adad8a1a..ad2579450 100644 --- a/modules/private-cluster-update-variant/README.md +++ b/modules/private-cluster-update-variant/README.md @@ -217,6 +217,7 @@ Then perform the following commands on the root folder: | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 034944c7f..36cba1037 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -497,6 +497,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -652,6 +656,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/private-cluster-update-variant/variables.tf b/modules/private-cluster-update-variant/variables.tf index bf168068e..3e2ee6a73 100644 --- a/modules/private-cluster-update-variant/variables.tf +++ b/modules/private-cluster-update-variant/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/private-cluster-update-variant/variables_defaults.tf b/modules/private-cluster-update-variant/variables_defaults.tf index b570f5f85..39a311980 100644 --- a/modules/private-cluster-update-variant/variables_defaults.tf +++ b/modules/private-cluster-update-variant/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/private-cluster-update-variant/versions.tf b/modules/private-cluster-update-variant/versions.tf index ebf289042..b91390550 100644 --- a/modules/private-cluster-update-variant/versions.tf +++ b/modules/private-cluster-update-variant/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/private-cluster/README.md b/modules/private-cluster/README.md index 1d90996d9..cfafe37a1 100644 --- a/modules/private-cluster/README.md +++ b/modules/private-cluster/README.md @@ -195,6 +195,7 @@ Then perform the following commands on the root folder: | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | non\_masquerade\_cidrs | List of strings in CIDR notation that specify the IP address ranges that do not use IP masquerading. | `list(string)` |
"all": [],
"default-node-pool": []
}
[| no | diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 5102b8a2f..609962330 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -403,6 +403,10 @@ resource "google_container_node_pool" "pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, @@ -557,6 +561,10 @@ resource "google_container_node_pool" "windows_pools" { local.node_pools_labels["all"], local.node_pools_labels[each.value["name"]], ) + resource_labels = merge( + local.node_pools_resource_labels["all"], + local.node_pools_resource_labels[each.value["name"]], + ) metadata = merge( lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {}, lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {}, diff --git a/modules/private-cluster/variables.tf b/modules/private-cluster/variables.tf index bf168068e..3e2ee6a73 100644 --- a/modules/private-cluster/variables.tf +++ b/modules/private-cluster/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/private-cluster/variables_defaults.tf b/modules/private-cluster/variables_defaults.tf index b570f5f85..39a311980 100644 --- a/modules/private-cluster/variables_defaults.tf +++ b/modules/private-cluster/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/modules/private-cluster/versions.tf b/modules/private-cluster/versions.tf index b761b263b..0294245b7 100644 --- a/modules/private-cluster/versions.tf +++ b/modules/private-cluster/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes" diff --git a/modules/safer-cluster-update-variant/README.md b/modules/safer-cluster-update-variant/README.md index 3a67aa66b..51875903a 100644 --- a/modules/safer-cluster-update-variant/README.md +++ b/modules/safer-cluster-update-variant/README.md @@ -255,6 +255,7 @@ For simplicity, we suggest using `roles/container.admin` and | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no | diff --git a/modules/safer-cluster-update-variant/main.tf b/modules/safer-cluster-update-variant/main.tf index 73a413d33..c5e1a90b1 100644 --- a/modules/safer-cluster-update-variant/main.tf +++ b/modules/safer-cluster-update-variant/main.tf @@ -82,12 +82,13 @@ module "gke" { // If removing the default node pool, initial_node_count should be at least 1. initial_node_count = (var.initial_node_count == 0) ? 1 : var.initial_node_count - node_pools = var.node_pools - windows_node_pools = var.windows_node_pools - node_pools_labels = var.node_pools_labels - node_pools_metadata = var.node_pools_metadata - node_pools_taints = var.node_pools_taints - node_pools_tags = var.node_pools_tags + node_pools = var.node_pools + windows_node_pools = var.windows_node_pools + node_pools_labels = var.node_pools_labels + node_pools_resource_labels = var.node_pools_resource_labels + node_pools_metadata = var.node_pools_metadata + node_pools_taints = var.node_pools_taints + node_pools_tags = var.node_pools_tags node_pools_oauth_scopes = var.node_pools_oauth_scopes diff --git a/modules/safer-cluster-update-variant/variables.tf b/modules/safer-cluster-update-variant/variables.tf index cc53aaed6..f42929b53 100644 --- a/modules/safer-cluster-update-variant/variables.tf +++ b/modules/safer-cluster-update-variant/variables.tf @@ -168,6 +168,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/modules/safer-cluster/README.md b/modules/safer-cluster/README.md index 3a67aa66b..51875903a 100644 --- a/modules/safer-cluster/README.md +++ b/modules/safer-cluster/README.md @@ -255,6 +255,7 @@ For simplicity, we suggest using `roles/container.admin` and | node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` |
"all": [],
"default-node-pool": []
}
{| no | | node\_pools\_metadata | Map of maps containing node metadata by node-pool name | `map(map(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_oauth\_scopes | Map of lists containing node oauth scopes by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | +| node\_pools\_resource\_labels | Map of maps containing resource labels by node-pool name | `map(map(string))` |
"all": [
"https://www.googleapis.com/auth/cloud-platform"
],
"default-node-pool": []
}
{| no | | node\_pools\_tags | Map of lists containing node network tags by node-pool name | `map(list(string))` |
"all": {},
"default-node-pool": {}
}
{| no | | node\_pools\_taints | Map of lists containing node taints by node-pool name | `map(list(object({ key = string, value = string, effect = string })))` |
"all": [],
"default-node-pool": []
}
{| no | | notification\_config\_topic | The desired Pub/Sub topic to which notifications will be sent by GKE. Format is projects/{project}/topics/{topic}. | `string` | `""` | no | diff --git a/modules/safer-cluster/main.tf b/modules/safer-cluster/main.tf index e54e6e68f..03a411eaa 100644 --- a/modules/safer-cluster/main.tf +++ b/modules/safer-cluster/main.tf @@ -82,12 +82,13 @@ module "gke" { // If removing the default node pool, initial_node_count should be at least 1. initial_node_count = (var.initial_node_count == 0) ? 1 : var.initial_node_count - node_pools = var.node_pools - windows_node_pools = var.windows_node_pools - node_pools_labels = var.node_pools_labels - node_pools_metadata = var.node_pools_metadata - node_pools_taints = var.node_pools_taints - node_pools_tags = var.node_pools_tags + node_pools = var.node_pools + windows_node_pools = var.windows_node_pools + node_pools_labels = var.node_pools_labels + node_pools_resource_labels = var.node_pools_resource_labels + node_pools_metadata = var.node_pools_metadata + node_pools_taints = var.node_pools_taints + node_pools_tags = var.node_pools_tags node_pools_oauth_scopes = var.node_pools_oauth_scopes diff --git a/modules/safer-cluster/variables.tf b/modules/safer-cluster/variables.tf index cc53aaed6..f42929b53 100644 --- a/modules/safer-cluster/variables.tf +++ b/modules/safer-cluster/variables.tf @@ -168,6 +168,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/variables.tf b/variables.tf index db2a9b774..c6b3f70ae 100644 --- a/variables.tf +++ b/variables.tf @@ -170,6 +170,16 @@ variable "node_pools_labels" { } } +variable "node_pools_resource_labels" { + type = map(map(string)) + description = "Map of maps containing resource labels by node-pool name" + + default = { + all = {} + default-node-pool = {} + } +} + variable "node_pools_metadata" { type = map(map(string)) description = "Map of maps containing node metadata by node-pool name" diff --git a/variables_defaults.tf b/variables_defaults.tf index b570f5f85..39a311980 100644 --- a/variables_defaults.tf +++ b/variables_defaults.tf @@ -34,6 +34,20 @@ locals { var.node_pools_labels ) + node_pools_resource_labels = merge( + { all = {} }, + { default-node-pool = {} }, + zipmap( + [for node_pool in var.node_pools : node_pool["name"]], + [for node_pool in var.node_pools : {}] + ), + zipmap( + [for node_pool in var.windows_node_pools : node_pool["name"]], + [for node_pool in var.windows_node_pools : {}] + ), + var.node_pools_resource_labels + ) + node_pools_metadata = merge( { all = {} }, { default-node-pool = {} }, diff --git a/versions.tf b/versions.tf index eebc0fed1..d7edee28e 100644 --- a/versions.tf +++ b/versions.tf @@ -21,7 +21,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 4.44.0, < 5.0" + version = ">= 4.45.0, < 5.0" } kubernetes = { source = "hashicorp/kubernetes"
"all": [],
"default-node-pool": []
}