Closed sblask closed 10 months ago
Would what described as item 3
(--retry-once-with-cleanup=true
) at https://github.com/antonbabenko/pre-commit-terraform?tab=readme-ov-file#terraform_validate help in your case?
Work as expected. terraform validate
will fail too in such conditions.
As George mentioned above, please use --retry-once-with-cleanup=true
to deal with that kind of issue.
Thanks for the help! I think it would make a lot of sense to make the retry the default? Running terraform init
is run by default to make things "just work" so running it again to make it "just work" in more situations would be consistent behaviour?
terraform init
does not always runAddition to File System it +- save operation, when removal - is not, by definition. Manual changes in .terraform/
are rare, but still exist.
Making two full validations are time-consuming operation
For that flag additional deps (jq
) is required, when other parts of hook able to work without it
Basically, all this stuff is already specified in README
In any case, that change can not be done until v2.0 which will come only when there are no other possibilities to continue making improvements to v1 (we will not support two versions in parallel)
To not forget, I added the next point to 2.0.0 [BREAKING CHANGES] milestone:
Describe the bug
terraform init
)I got this error:
Presumably because
terraform init
wasn't run again as the terraform directories that pre-commit-terraform checks for are already there (https://github.com/antonbabenko/pre-commit-terraform/blob/master/hooks/_common.sh#L328)How can we reproduce it?
See above.
Environment information
OS: OS: MacOS
uname -a
and/orsysteminfo | Select-String "^OS"
output:.pre-commit-config.yaml
:file content
```bash repos: - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.83.5 hooks: - id: terraform_docs args: - --args=--config=.terraform-docs.yml - id: terraform_fmt - id: terraform_tflint args: - --args=--config=__GIT_WORKING_DIR__/.tflint.hcl - id: terraform_validate - repo: https://github.com/editorconfig-checker/editorconfig-checker.python rev: 2.7.1 hooks: - id: editorconfig-checker ```