Skip to content

Commit 0dd21f0

Browse files
committed
fix(terraform_providers_lock): Log in which folder hook failed
1 parent cba8773 commit 0dd21f0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hooks/terraform_providers_lock.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,14 @@ Check migration instructions at https://github.com/antonbabenko/pre-commit-terra
157157
# pass the arguments to hook
158158
"$tf_path" providers lock "${args[@]}"
159159

160-
# return exit code to common::per_dir_hook
161160
exit_code=$?
161+
if [[ $exit_code != 0 ]]; then
162+
common::colorify "red" "$dir_path run failed. Detailed error above.
163+
Most common issue is that you didn't run requiring 'terraform init' before running this hook. It can be run by 'terraform_validate' hook - https://github.com/antonbabenko/pre-commit-terraform#terraform_validate
164+
"
165+
fi
166+
167+
# return exit code to common::per_dir_hook
162168
return $exit_code
163169
}
164170

0 commit comments

Comments
 (0)