mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
feat: Add --retry-once-with-cleanup to terraform_validate (#441)
This commit is contained in:
parent
a15204beed
commit
96fe3ef657
3 changed files with 140 additions and 22 deletions
|
|
@ -299,13 +299,15 @@ function common::terraform_init {
|
|||
TF_INIT_ARGS+=("-no-color")
|
||||
fi
|
||||
|
||||
if [ ! -d .terraform ]; then
|
||||
if [ ! -d .terraform/modules ] || [ ! -d .terraform/providers ]; then
|
||||
init_output=$(terraform init -backend=false "${TF_INIT_ARGS[@]}" 2>&1)
|
||||
exit_code=$?
|
||||
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
common::colorify "red" "'terraform init' failed, '$command_name' skipped: $dir_path"
|
||||
echo -e "$init_output\n\n"
|
||||
else
|
||||
common::colorify "green" "Command 'terraform init' successfully done: $dir_path"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue