Skip to content

Commit

Permalink
feat: Hook terraform_wrapper_module_for_each should use versions.tf f…
Browse files Browse the repository at this point in the history
…rom the module if it exists (#657)

Co-authored-by: Nick Henry <hnicholas@vmware.com>
  • Loading branch information
nshenry03 and Nick Henry committed Apr 15, 2024
1 parent 42919f3 commit b127601
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hooks/terraform_wrapper_module_for_each.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,13 @@ EOF
mv "$tmp_file_tf" "${output_dir}/main.tf"

echo "$CONTENT_VARIABLES_TF" > "${output_dir}/variables.tf"
echo "$CONTENT_VERSIONS_TF" > "${output_dir}/versions.tf"

# If the root module has a versions.tf, use that; otherwise, create it
if [[ -f "${full_module_dir}/versions.tf" ]]; then
cp "${full_module_dir}/versions.tf" "${output_dir}/versions.tf"
else
echo "$CONTENT_VERSIONS_TF" > "${output_dir}/versions.tf"
fi

echo "$CONTENT_OUTPUTS_TF" > "${output_dir}/outputs.tf"
sed -i.bak "s|WRAPPER_OUTPUT_SENSITIVE|${wrapper_output_sensitive}|g" "${output_dir}/outputs.tf"
Expand Down

0 comments on commit b127601

Please sign in to comment.