From 19188e5c384a1803bca607e4e79faf61cc55a5b9 Mon Sep 17 00:00:00 2001 From: Maksym Vlasov Date: Mon, 4 Sep 2023 16:58:00 +0300 Subject: [PATCH] fix: Extend `terraform_validate` `--retry-once-with-cleanup` errors list (#566) --- hooks/terraform_validate.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hooks/terraform_validate.sh b/hooks/terraform_validate.sh index 30e7f54f5..0ba67817d 100755 --- a/hooks/terraform_validate.sh +++ b/hooks/terraform_validate.sh @@ -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") @@ -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 @@ -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=$?