Skip to content

Commit

Permalink
Fixes terraform-google-modules#1386: Support confidential nodepools
Browse files Browse the repository at this point in the history
  • Loading branch information
abhikaddy committed Oct 1, 2023
1 parent abdba8c commit d683e56
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"confidential_nodes"
]
}

Expand Down Expand Up @@ -775,6 +776,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
12 changes: 12 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -653,6 +659,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
13 changes: 13 additions & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"confidential_nodes"
]
}

Expand Down Expand Up @@ -665,6 +666,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -893,6 +900,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
12 changes: 12 additions & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -798,6 +804,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
13 changes: 13 additions & 0 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"confidential_nodes"
]
}

Expand Down Expand Up @@ -646,6 +647,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -874,6 +881,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
12 changes: 12 additions & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -779,6 +785,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
13 changes: 13 additions & 0 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"confidential_nodes"
]
}

Expand Down Expand Up @@ -578,6 +579,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -767,6 +774,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down
12 changes: 12 additions & 0 deletions modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,12 @@ resource "google_container_node_pool" "pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down Expand Up @@ -672,6 +678,12 @@ resource "google_container_node_pool" "windows_pools" {
enabled = gvnic.value
}
}
dynamic "confidential_nodes" {
for_each = lookup(each.value, "enable_confidential_nodes", false) ? [true] : []
content {
enabled = confidential_nodes.value
}
}
labels = merge(
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = each.value["name"] } : {},
Expand Down

0 comments on commit d683e56

Please sign in to comment.