Skip to content
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

fix: Extend terraform_validate --retry-once-with-cleanup errors list #566

Merged
merged 2 commits into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions hooks/terraform_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function match_validate_errors {
"Module version requirements have changed") return 1 ;;
"Module not installed") return 1 ;;
"Could not load plugin") return 1 ;;
*"there is no package for"*"cached in .terraform/providers") return 1 ;;
esac
done < <(jq -rc '.diagnostics[]' <<< "$validate_output")

Expand Down Expand Up @@ -100,7 +101,7 @@ function per_dir_hook_unique_part {

case $key in
--retry-once-with-cleanup)
if [ $retry_once_with_cleanup ]; then
if [ "$retry_once_with_cleanup" ]; then
common::colorify "yellow" 'Invalid hook config. Make sure that you specify not more than one "--retry-once-with-cleanup" flag'
exit 1
fi
Expand All @@ -117,7 +118,7 @@ function per_dir_hook_unique_part {
return $exit_code
}

# In case `terraform validate` failed to execute
# In case `terraform validate` failed to execute
# - check is simple `terraform init` will help
common::terraform_init 'terraform validate' "$dir_path" || {
exit_code=$?
Expand Down