Skip to content
Open
Changes from all 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
4 changes: 3 additions & 1 deletion hooks/terraform-fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export PATH=$PATH:/usr/local/bin
FMT_ERROR=0

for file in "$@"; do
terraform fmt -diff -check "$file" || FMT_ERROR=$?
pushd "$(dirname "$file")" >/dev/null
terraform fmt -diff -check "$(basename "$file")" || FMT_ERROR=$?
popd >/dev/null
done

# reset path to the original value
Expand Down