diff --git a/README.md b/README.md index 0e5cf2eaf8..08fe28c755 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 4758f9e6f3..68476199f5 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 043d236c39..c39235a0fc 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 1706713eb9..d98c962876 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 6a0f857199..70f2791b68 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 112c287399..b647a7014b 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 9fd29370f8..a357cbe241 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 85cac2f85e..eeccd2b2ae 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 d2c56938fc..8aa8b5015a 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 f33d10d73b..4660c27a48 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 e1803a6179..0a62257bdc 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 3af2360b34..e9cbce1917 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 e2769759d3..e51ecb34d8 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 cc65ac9e8b..e4f3004771 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 309dfee7b4..41d7da6de2 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 1e0b0c6553..96bb1ca0ce 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 0f34bed4b3..0040d5d9bf 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 e2769759d3..e51ecb34d8 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 cc65ac9e8b..e4f3004771 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 1484f8db34..1ebe76708d 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 141d348292..4cbb6b77ba 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 449423de4d..09938b2cb2 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 e0f03aacd3..2de66dd1be 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 cc65ac9e8b..e4f3004771 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 5239940eb1..c73ab8d4ca 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 cd197ff2fe..f95eb99845 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 7854d50db6..8ced172253 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 e0f03aacd3..2de66dd1be 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 cc65ac9e8b..e4f3004771 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 637074ea19..b8779bc6fd 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 4adad8a1a8..ad2579450c 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 034944c7f4..36cba10371 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 bf168068e6..3e2ee6a736 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 b570f5f850..39a311980c 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 ebf2890425..b913905509 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 1d90996d97..cfafe37a11 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 5102b8a2f9..6099623302 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 bf168068e6..3e2ee6a736 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 b570f5f850..39a311980c 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 b761b263b1..0294245b7a 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 3a67aa66b0..51875903a4 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 73a413d335..c5e1a90b1b 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 cc53aaed63..f42929b53f 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 3a67aa66b0..51875903a4 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 e54e6e68fe..03a411eaa6 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 cc53aaed63..f42929b53f 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 db2a9b7746..c6b3f70ae9 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 b570f5f850..39a311980c 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 eebc0fed1e..d7edee28ec 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": []
}