From 8681c07c1e3eae9e6bc68a88d9b8f3d9df63753c Mon Sep 17 00:00:00 2001 From: Rodrigo Brasil <rodrigobbrasil@gmail.com> Date: Fri, 13 May 2022 11:51:30 -0300 Subject: [PATCH] feature: app's ssm parameters creation --- _variables.tf | 12 ++++++++++++ ssm.tf | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 ssm.tf diff --git a/_variables.tf b/_variables.tf index 1086fa9..959e3ff 100644 --- a/_variables.tf +++ b/_variables.tf @@ -466,3 +466,15 @@ variable "redirects" { description = "Map of path redirects to add to the listener" default = {} } + +variable "ssm_parameters_secure_strings" { + type = any + default = [] + description = "List of app's secure variables to be created in SSM Parameter Store" +} + +variable "ssm_parameters_strings" { + type = any + default = {} + description = "List of objects of app's variables to create in SSM Parameter Store" +} \ No newline at end of file diff --git a/ssm.tf b/ssm.tf new file mode 100644 index 0000000..4573543 --- /dev/null +++ b/ssm.tf @@ -0,0 +1,23 @@ +resource "aws_ssm_parameter" "secure_string" { + for_each = toset(var.ssm_parameters_secure_strings) + name = "/ecs/${var.cluster_name}/${var.name}/${each.key}" + description = each.value + type = "SecureString" + value = "PLACEHOLDER" + + lifecycle { + ignore_changes = [value] + } +} + +resource "aws_ssm_parameter" "string" { + for_each = var.ssm_parameters_strings + name = "/ecs/${var.cluster_name}/${var.name}/${each.key}" + description = each.key + type = "String" + value = each.value + + lifecycle { + ignore_changes = [value] + } +} \ No newline at end of file