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

feat: Speedup terraform_validate - firstly try run validate without checking is .terraform/ is valid #524

Merged
merged 3 commits into from
Jun 12, 2023
Merged
Changes from 2 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
10 changes: 10 additions & 0 deletions hooks/terraform_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ function per_dir_hook_unique_part {
esac
done

# First try `terraform validate` with the hope that all deps are
# pre-installed. That is needed for cases when `.terraform/modules`
# or `.terraform/providers` missed AND that is expected.
terraform validate "${args[@]}" 2>&1 && {
exit_code=$?
return $exit_code
}

MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved
# In case `terraform validate` failed to execute
# - check is simple `terraform init` will help
MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved
common::terraform_init 'terraform validate' "$dir_path" || {
exit_code=$?
return $exit_code
Expand Down