From ec8ea71eb7d0c200e0f868c1cb1eeec3540de3c1 Mon Sep 17 00:00:00 2001 From: Wellyson Freitas Date: Sat, 16 Mar 2024 18:46:51 +0100 Subject: [PATCH] Store SSM params --- terraform/main.tf | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/terraform/main.tf b/terraform/main.tf index e663f5a..d1b5279 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,5 +1,7 @@ locals { - name = "selfordermanagementdb" + name = "selfordermanagementdb" + username = "master" + port = 5432 } data "terraform_remote_state" "tech-challenge" { @@ -30,8 +32,8 @@ module "db" { storage_encrypted = false db_name = local.name - username = "master" - port = 5432 + username = local.username + port = local.port manage_master_user_password = true @@ -60,3 +62,14 @@ module "security_group" { }, ] } + +module "ssm_parameters" { + source = "terraform-aws-modules/ssm-parameter/aws" + name = "live/selfordermanagement/db" + type = "String" + value = jsonencode({ + name : local.name, + host : module.db.db_instance_endpoint, + port : local.port + }) +}