mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
feat: Speedup terraform_validate - firstly try run validate without checking is .terraform/ is valid (#524)
This commit is contained in:
parent
148eb8f778
commit
d0d08ac63c
1 changed files with 10 additions and 0 deletions
|
|
@ -109,6 +109,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
|
||||
}
|
||||
|
||||
# In case `terraform validate` failed to execute
|
||||
# - check is simple `terraform init` will help
|
||||
common::terraform_init 'terraform validate' "$dir_path" || {
|
||||
exit_code=$?
|
||||
return $exit_code
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue