diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 577dc312f5..459f4f712c 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -714,7 +714,6 @@ resource "google_container_node_pool" "windows_pools" { } } - {% if beta_cluster %} dynamic "placement_policy" { for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] content { @@ -733,7 +732,6 @@ resource "google_container_node_pool" "windows_pools" { {% endif %} } } - {% endif %} management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/cluster.tf b/cluster.tf index 2332cc8e26..3f8c070a61 100644 --- a/cluster.tf +++ b/cluster.tf @@ -436,6 +436,20 @@ resource "google_container_node_pool" "pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = lookup(network_config.value, "enable_private_nodes", null) + } + } management { auto_repair = lookup(each.value, "auto_repair", true) @@ -631,6 +645,20 @@ resource "google_container_node_pool" "windows_pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = lookup(network_config.value, "enable_private_nodes", null) + } + } management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index aa9cd45ea9..a6bbfa9b59 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -530,6 +530,20 @@ resource "google_container_node_pool" "pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = var.enable_private_nodes + } + } management { auto_repair = lookup(each.value, "auto_repair", true) @@ -726,6 +740,20 @@ resource "google_container_node_pool" "windows_pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = var.enable_private_nodes + } + } management { auto_repair = lookup(each.value, "auto_repair", true) diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index f9c3266a6b..e8eefa20df 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -455,6 +455,20 @@ resource "google_container_node_pool" "pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = var.enable_private_nodes + } + } management { auto_repair = lookup(each.value, "auto_repair", true) @@ -650,6 +664,20 @@ resource "google_container_node_pool" "windows_pools" { } } + dynamic "placement_policy" { + for_each = length(lookup(each.value, "placement_policy", "")) > 0 ? [each.value] : [] + content { + type = lookup(placement_policy.value, "placement_policy", null) + } + } + + dynamic "network_config" { + for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : [] + content { + pod_range = lookup(network_config.value, "pod_range", null) + enable_private_nodes = var.enable_private_nodes + } + } management { auto_repair = lookup(each.value, "auto_repair", true)