From 5e6711fd85448436ea1ffe7c377fd9d46eafeeeb Mon Sep 17 00:00:00 2001 From: Darren Lee <167146344+darrenl33@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:32:09 -0800 Subject: [PATCH] Allow removal of cluster name from aurora ssm parameter (#1162) Co-authored-by: Benjamin Smith Co-authored-by: Igor Rodionov --- modules/aurora-postgres/ssm.tf | 2 +- modules/aurora-postgres/variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/aurora-postgres/ssm.tf b/modules/aurora-postgres/ssm.tf index 9b74979dd..9e62a508f 100644 --- a/modules/aurora-postgres/ssm.tf +++ b/modules/aurora-postgres/ssm.tf @@ -1,5 +1,5 @@ locals { - ssm_path_prefix = format("/%s/%s", var.ssm_path_prefix, module.cluster.id) + ssm_path_prefix = length(var.ssm_cluster_name_override) > 0 ? format("/%s/%s", var.ssm_path_prefix, var.ssm_cluster_name_override) : format("/%s/%s", var.ssm_path_prefix, module.cluster.id) admin_user_key = format("%s/%s/%s", local.ssm_path_prefix, "admin", "user") admin_password_key = format("%s/%s/%s", local.ssm_path_prefix, "admin", "password") diff --git a/modules/aurora-postgres/variables.tf b/modules/aurora-postgres/variables.tf index ea71e52f0..1bc227790 100644 --- a/modules/aurora-postgres/variables.tf +++ b/modules/aurora-postgres/variables.tf @@ -352,3 +352,9 @@ variable "backup_window" { default = "07:00-09:00" description = "Daily time range during which the backups happen, UTC" } + +variable "ssm_cluster_name_override" { + type = string + default = "" + description = "Set a cluster name into the ssm path prefix" +}