Skip to content

Commit 941177e

Browse files
authored
fix: Fix terraform_wrapper_module_for_each for when resource name contains 'variable' (antonbabenko#573)
1 parent ed1104c commit 941177e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hooks/terraform_wrapper_module_for_each.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ EOF
321321

322322
# Get names of module variables in all terraform files
323323
# shellcheck disable=SC2207
324-
module_vars=($(echo "$all_tf_content" | hcledit block list | { grep variable. | cut -d'.' -f 2 | sort || true; }))
324+
module_vars=($(echo "$all_tf_content" | hcledit block list | { grep "^variable\." | cut -d'.' -f 2 | sort || true; }))
325325

326326
# Get names of module outputs in all terraform files
327327
# shellcheck disable=SC2207
328-
module_outputs=($(echo "$all_tf_content" | hcledit block list | { grep output. | cut -d'.' -f 2 || true; }))
328+
module_outputs=($(echo "$all_tf_content" | hcledit block list | { grep "^output\." | cut -d'.' -f 2 || true; }))
329329

330330
# Get names of module providers in all terraform files
331-
module_providers=$(echo "$all_tf_content" | hcledit block list | { grep provider. || true; })
331+
module_providers=$(echo "$all_tf_content" | hcledit block list | { grep "^provider\." || true; })
332332

333333
if [[ $module_providers ]]; then
334334
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."

0 commit comments

Comments
 (0)