Giter Club home page Giter Club logo

Comments (4)

MaxymVlasov avatar MaxymVlasov commented on June 3, 2024 1
  1. terraform init does not always run

# 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[@]}" &> /dev/null && {
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
}

  1. Addition to File System it +- save operation, when removal - is not, by definition. Manual changes in .terraform/ are rare, but still exist.

  2. Making two full validations are time-consuming operation

  3. 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:

  • Make hooks flags, which are highly used to tweak hooks, enabled by default

from pre-commit-terraform.

yermulnik avatar yermulnik commented on June 3, 2024

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?

from pre-commit-terraform.

MaxymVlasov avatar MaxymVlasov commented on June 3, 2024

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.

from pre-commit-terraform.

sblask avatar sblask commented on June 3, 2024

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?

from pre-commit-terraform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.