diff --git a/autogen/cluster.tf b/autogen/cluster.tf index 0bac34a37e..7353468cd7 100644 --- a/autogen/cluster.tf +++ b/autogen/cluster.tf @@ -316,16 +316,18 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + {% if beta_cluster %} max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null) {% endif %} - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/cluster.tf b/cluster.tf index 7e5f53ee47..072a60fb14 100644 --- a/cluster.tf +++ b/cluster.tf @@ -137,13 +137,15 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 6039cecd98..c92695ce49 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -290,14 +290,16 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null) - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 10e12a9ba0..fb9b1ee683 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -218,14 +218,16 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null) - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index b5f896bc1b..88725475a8 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -213,14 +213,16 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + max_pods_per_node = lookup(var.node_pools[count.index], "max_pods_per_node", null) - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 615fe84bcc..d7fc2dd736 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -214,13 +214,15 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : [] diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 3c42e64325..c8051255bf 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -142,13 +142,15 @@ resource "google_container_node_pool" "pools" { "version", local.node_version, ) - initial_node_count = lookup( + + initial_node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? lookup( var.node_pools[count.index], "initial_node_count", - lookup(var.node_pools[count.index], "min_count", 1), - ) + lookup(var.node_pools[count.index], "min_count", 1) + ) : null + - node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "min_count", 1) + node_count = lookup(var.node_pools[count.index], "autoscaling", true) ? null : lookup(var.node_pools[count.index], "node_count", 1) dynamic "autoscaling" { for_each = lookup(var.node_pools[count.index], "autoscaling", true) ? [var.node_pools[count.index]] : []