From 449251f9d51b60f4cc6c79f2d6b090b6aaf03cfd Mon Sep 17 00:00:00 2001 From: "Karapetyan, Aram" Date: Wed, 20 Sep 2023 19:06:25 +0400 Subject: [PATCH] fix(DMVP-0000): adjust values to be returned as map instead of list --- modules/variable-set-reader/main.tf | 4 ++++ modules/variable-set-reader/output.tf | 2 +- modules/variable-set-reader/tests/basic/1-example.tf | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/variable-set-reader/main.tf b/modules/variable-set-reader/main.tf index a359025..5043de5 100644 --- a/modules/variable-set-reader/main.tf +++ b/modules/variable-set-reader/main.tf @@ -6,3 +6,7 @@ data "tfe_variable_set" "this" { data "tfe_variables" "this" { variable_set_id = data.tfe_variable_set.this.id } + +locals { + results = { for value in data.tfe_variables.this.variables : value.name => value.value } +} diff --git a/modules/variable-set-reader/output.tf b/modules/variable-set-reader/output.tf index 4d90dd1..2dc2461 100644 --- a/modules/variable-set-reader/output.tf +++ b/modules/variable-set-reader/output.tf @@ -1,4 +1,4 @@ output "values" { - value = data.tfe_variables.this.variables + value = local.results sensitive = true } diff --git a/modules/variable-set-reader/tests/basic/1-example.tf b/modules/variable-set-reader/tests/basic/1-example.tf index 3d96858..d4ac53c 100644 --- a/modules/variable-set-reader/tests/basic/1-example.tf +++ b/modules/variable-set-reader/tests/basic/1-example.tf @@ -1,8 +1,8 @@ variable "tfc_token" {} module "basic" { source = "../.." - name = "some-test-variable-set" - org = "dasmeta-testing" + name = "aws_credentials" + org = "dasmeta" tfc_token = var.tfc_token }