From 75f0394d26a5cfab93ec8baa5998c26148372d0c Mon Sep 17 00:00:00 2001 From: Ronaldo Macapobre Date: Tue, 10 Dec 2024 21:21:21 +0000 Subject: [PATCH] Pass kms_key_id --- infrastructure/cloud/environments/test/webapp.tf | 1 + infrastructure/cloud/modules/IAM/main.tf | 2 +- infrastructure/cloud/modules/IAM/variables.tf | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/infrastructure/cloud/environments/test/webapp.tf b/infrastructure/cloud/environments/test/webapp.tf index 56cacb03..38f35ef6 100644 --- a/infrastructure/cloud/environments/test/webapp.tf +++ b/infrastructure/cloud/environments/test/webapp.tf @@ -77,6 +77,7 @@ module "iam" { iam_user_table_name = var.iam_user_table_name secrets_arn_list = module.secrets_manager.secrets_arn_list account_id = data.aws_caller_identity.current.account_id + kms_key_id = data.aws_kms_key.kms_key.id } # Parse Subnets diff --git a/infrastructure/cloud/modules/IAM/main.tf b/infrastructure/cloud/modules/IAM/main.tf index 1658e67e..42542fe9 100644 --- a/infrastructure/cloud/modules/IAM/main.tf +++ b/infrastructure/cloud/modules/IAM/main.tf @@ -2,7 +2,7 @@ # KMS Key Policy # resource "aws_kms_key_policy" "kms_key_policy" { - key_id = aws_kms_key.kms_key.id + key_id = var.kms_key_id policy = jsonencode({ Version = "2012-10-17" diff --git a/infrastructure/cloud/modules/IAM/variables.tf b/infrastructure/cloud/modules/IAM/variables.tf index 285be9b5..c8e3c9c1 100644 --- a/infrastructure/cloud/modules/IAM/variables.tf +++ b/infrastructure/cloud/modules/IAM/variables.tf @@ -37,3 +37,8 @@ variable "account_id" { description = "The current AWS Account Id" type = string } + +variable "kms_key_id" { + description = "The custom KMS Key Id" + type = string +}