Skip to content

Commit f02567b

Browse files
committed
Merge branch 'mark5cinco-gke-cluster-encrpytion'
2 parents 4db18fb + 998b968 commit f02567b

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

google/_modules/gke/cluster.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ resource "google_container_cluster" "current" {
2525
}
2626
}
2727

28+
dynamic "database_encryption" {
29+
for_each = var.cluster_database_encryption_key_name != null ? toset([1]) : toset([])
30+
content {
31+
state = "ENCRYPTED"
32+
key_name = var.cluster_database_encryption_key_name
33+
}
34+
}
35+
2836
#
2937
#
3038
# Addon config

google/_modules/gke/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,8 @@ variable "enable_tpu" {
173173
description = "Whether to enable GKE cloud TPU support."
174174
type = bool
175175
}
176+
177+
variable "cluster_database_encryption_key_name" {
178+
type = string
179+
description = "Cloud KMS key name for enabling cluster database encryption."
180+
}

google/cluster/configuration.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ locals {
6060
cluster_ipv4_cidr_block = lookup(local.cfg, "cluster_ipv4_cidr_block", null)
6161
services_ipv4_cidr_block = lookup(local.cfg, "services_ipv4_cidr_block", null)
6262

63+
cluster_database_encryption_key_name = lookup(local.cfg, "cluster_database_encryption_key_name", false)
64+
6365
# by default include cloud_nat when private nodes are enabled
6466
enable_cloud_nat = lookup(local.cfg, "enable_cloud_nat", local.enable_private_nodes)
6567
cloud_nat_endpoint_independent_mapping = lookup(local.cfg, "cloud_nat_enable_endpoint_independent_mapping", null)

google/cluster/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ module "cluster" {
6363
disable_workload_identity = local.disable_workload_identity
6464
node_workload_metadata_config = local.node_workload_metadata_config
6565

66+
cluster_database_encryption_key_name = local.cluster_database_encryption_key_name
67+
6668
enable_intranode_visibility = local.enable_intranode_visibility
6769
enable_tpu = local.enable_tpu
6870
}

0 commit comments

Comments
 (0)