Skip to content

Commit 19188e5

Browse files
authored
fix: Extend terraform_validate --retry-once-with-cleanup errors list (antonbabenko#566)
1 parent da379f6 commit 19188e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hooks/terraform_validate.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function match_validate_errors {
5555
"Module version requirements have changed") return 1 ;;
5656
"Module not installed") return 1 ;;
5757
"Could not load plugin") return 1 ;;
58+
*"there is no package for"*"cached in .terraform/providers") return 1 ;;
5859
esac
5960
done < <(jq -rc '.diagnostics[]' <<< "$validate_output")
6061

@@ -100,7 +101,7 @@ function per_dir_hook_unique_part {
100101

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

120-
# In case `terraform validate` failed to execute
121+
# In case `terraform validate` failed to execute
121122
# - check is simple `terraform init` will help
122123
common::terraform_init 'terraform validate' "$dir_path" || {
123124
exit_code=$?

0 commit comments

Comments
 (0)