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 90af8e10c8..e8eefa20df 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -664,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)