From 61b48f6d0fb4dc3041591757eb8b995a5965a312 Mon Sep 17 00:00:00 2001 From: Mariusz Wojakowski Date: Wed, 25 Jan 2023 13:06:18 +0100 Subject: [PATCH] fix: Fix issues with missing context when enabled=false (#13) Co-authored-by: mariusz.wojakowski --- README.md | 2 +- locals.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f3bd620..6cfaf0a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ _Brief Description of MODULE:_ * _What it does_ -* _What techonlogies it uses_ +* _What technologies it uses_ > **Warning**: > _When using "Invicton-Labs/deepmerge/null" module - pin `tflint` version to `v0.41.0` in [pre-commit.yaml](.github/workflows/pre-commit.yml) to avoid failing `tflint` checks_ diff --git a/locals.tf b/locals.tf index c457489..ea255b8 100644 --- a/locals.tf +++ b/locals.tf @@ -1,9 +1,9 @@ locals { # Get a name from the descriptor. If not available, use default naming convention. # Trim and replace function are used to avoid bare delimiters on both ends of the name and situation of adjacent delimiters. - name_from_descriptor = trim(replace( + name_from_descriptor = local.enabled ? trim(replace( lookup(module.this.descriptors, "module-resource-name", module.this.id), "/${module.this.delimiter}${module.this.delimiter}+/", module.this.delimiter - ), module.this.delimiter) + ), module.this.delimiter) : null enabled = module.this.enabled }