Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions fast/stages-aw/3-security/core-dev.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ module "dev-sec-kms" {
keyring = {
location = each.key
name = "dev-${each.key}"
version_template = {
algorithm = "GOOGLE_SYMMETRIC_ENCRYPTION"
protection_level = var.kms_protection_level
}
}
keys = local.kms_locations_keys[each.key]
}
4 changes: 0 additions & 4 deletions fast/stages-aw/3-security/core-prod.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ module "prod-sec-kms" {
keyring = {
location = each.key
name = "prod-${each.key}"
version_template = {
algorithm = "GOOGLE_SYMMETRIC_ENCRYPTION"
protection_level = var.kms_protection_level
}
}
keys = local.kms_locations_keys[each.key]
}
17 changes: 16 additions & 1 deletion fast/stages-aw/3-security/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,26 @@ locals {
for k, v in var.kms_keys : v.locations
]))
# map { location -> { key_name -> key_details } }
# Keys that do not set their own version_template inherit the stage-wide
# protection level here. modules/kms only honours version_template per key
# (its keyring object is {location, name}), so this is the only place the
# stage can apply var.kms_protection_level.
kms_locations_keys = {
for loc in local.kms_locations :
loc => {
for k, v in var.kms_keys :
k => v
k => merge(v, {
version_template = (
v.version_template != null
? v.version_template
: var.kms_protection_level == null
? null
: {
algorithm = "GOOGLE_SYMMETRIC_ENCRYPTION"
protection_level = var.kms_protection_level
}
)
})
if contains(v.locations, loc)
}
}
Expand Down
2 changes: 1 addition & 1 deletion fast/stages-aw/3-security/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ variable "kms_keys" {
}

variable "kms_protection_level" {
description = "KMS protection level."
description = "Protection level (HSM or SOFTWARE) applied to every key in kms_keys that does not set its own version_template."
type = string
nullable = true
}
Expand Down