Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #64 from gruntwork-io/encrypted_secrets
Browse files Browse the repository at this point in the history
Add ability to encrypt etcd secrets at rest
  • Loading branch information
autero1 authored Sep 30, 2019
2 parents 8d25033 + d90b558 commit 1763bb3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ resource "google_container_cluster" "cluster" {
]
}

# If a var.gsuite_domain_name is non-empty, initialize the cluster with a G Suite security group
# If var.gsuite_domain_name is non-empty, initialize the cluster with a G Suite security group
dynamic "authenticator_groups_config" {
for_each = [
for x in [var.gsuite_domain_name] : x if var.gsuite_domain_name != null
Expand All @@ -143,6 +143,18 @@ resource "google_container_cluster" "cluster" {
security_group = "gke-security-groups@${authenticator_groups_config.value}"
}
}

# If var.secrets_encryption_kms_key is non-empty, create ´database_encryption´ -block to encrypt secrets at rest in etcd
dynamic "database_encryption" {
for_each = [
for x in [var.secrets_encryption_kms_key] : x if var.secrets_encryption_kms_key != null
]

content {
state = "ENCRYPTED"
key_name = database_encryption.value
}
}
}

# ---------------------------------------------------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions modules/gke-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@ variable "gsuite_domain_name" {
type = string
default = null
}

variable "secrets_encryption_kms_key" {
description = "The Cloud KMS key to use for the encryption of secrets in etcd, e.g: projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key"
type = string
default = null
}

0 comments on commit 1763bb3

Please sign in to comment.