Skip to content

fix(terraform_docs, terraform_wrapper_module_for_each): Improve .tofu files support #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hooks/terraform_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function terraform_docs {
#
if $create_if_not_exist && [[ ! -f "$output_file" ]]; then
dir_have_tf_files="$(
find . -maxdepth 1 -type f | sed 's|.*\.||' | sort -u | grep -oE '^tf$|^tfvars$' ||
find . -maxdepth 1 -type f \( -name '*.tf' -o -name '*.tofu' -o -name '*.tfvars' \) ||
exit 0
)"

Expand Down
4 changes: 2 additions & 2 deletions hooks/terraform_wrapper_module_for_each.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ EOF

# Read content of all terraform files
# shellcheck disable=SC2207
all_tf_content=$(find "${full_module_dir}" -name '*.tf' -maxdepth 1 -type f -exec cat {} +)
all_tf_content=$(find "${full_module_dir}" \( -name '*.tf' -o -name '*.tofu' \) -maxdepth 1 -type f -exec cat {} +)

if [[ ! $all_tf_content ]]; then
common::colorify "yellow" "Skipping ${full_module_dir} because there are no *.tf files."
common::colorify "yellow" "Skipping ${full_module_dir} because there are no .tf or .tofu files."
continue
fi

Expand Down