From 57586a59d89fc3b64955b4696ff63b4b283847dd Mon Sep 17 00:00:00 2001 From: Joe Ferris Date: Thu, 27 Apr 2023 15:06:21 -0400 Subject: [PATCH] Fix user managed secret environment variables - Terraform was complaining about calling `nonsensitive` when the value wasn't sensitive; this forces the initial value to potentially be sensitive to avoid the error. - We can skip parsing out the environment variables for the user managed secret module, because they are passed in directly. --- secret/main.tf | 2 +- user-managed-secret/outputs.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/secret/main.tf b/secret/main.tf index 179b74c..6c9ab51 100644 --- a/secret/main.tf +++ b/secret/main.tf @@ -288,7 +288,7 @@ locals { rotation_role_name = coalesce(var.rotation_role_name, "${var.name}-rotation") env_vars = nonsensitive([ - for key in try(keys(jsondecode(var.initial_value)), []) : + for key in try(keys(jsondecode(sensitive(var.initial_value))), []) : key if upper(key) == key ]) } diff --git a/user-managed-secret/outputs.tf b/user-managed-secret/outputs.tf index 7c90a99..9438f5e 100644 --- a/user-managed-secret/outputs.tf +++ b/user-managed-secret/outputs.tf @@ -5,7 +5,7 @@ output "arn" { output "environment_variables" { description = "Environment variables provided by this secret" - value = module.secret.environment_variables + value = var.environment_variables } output "id" {