From 941177e066e8de255f58f0a5afbda72995eb3f08 Mon Sep 17 00:00:00 2001 From: Nicholas Henry Date: Fri, 22 Sep 2023 01:18:04 -0600 Subject: [PATCH] fix: Fix terraform_wrapper_module_for_each for when resource name contains 'variable' (#573) --- hooks/terraform_wrapper_module_for_each.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/terraform_wrapper_module_for_each.sh b/hooks/terraform_wrapper_module_for_each.sh index 886b7080a..b01fe4601 100755 --- a/hooks/terraform_wrapper_module_for_each.sh +++ b/hooks/terraform_wrapper_module_for_each.sh @@ -321,14 +321,14 @@ EOF # Get names of module variables in all terraform files # shellcheck disable=SC2207 - module_vars=($(echo "$all_tf_content" | hcledit block list | { grep variable. | cut -d'.' -f 2 | sort || true; })) + module_vars=($(echo "$all_tf_content" | hcledit block list | { grep "^variable\." | cut -d'.' -f 2 | sort || true; })) # Get names of module outputs in all terraform files # shellcheck disable=SC2207 - module_outputs=($(echo "$all_tf_content" | hcledit block list | { grep output. | cut -d'.' -f 2 || true; })) + module_outputs=($(echo "$all_tf_content" | hcledit block list | { grep "^output\." | cut -d'.' -f 2 || true; })) # Get names of module providers in all terraform files - module_providers=$(echo "$all_tf_content" | hcledit block list | { grep provider. || true; }) + module_providers=$(echo "$all_tf_content" | hcledit block list | { grep "^provider\." || true; }) if [[ $module_providers ]]; then common::colorify "yellow" "Skipping ${full_module_dir} because it is a legacy module which contains its own local provider configurations and so calls to it may not use the for_each argument."