Giter VIP home page Giter VIP logo

Comments (14)

stevie- avatar stevie- commented on July 18, 2024 7

It seems that it is required to run terraform init for all sub directory modules. How can we workaround this or pre-execute terraform init automatically?

from pre-commit-terraform.

ahmad-hamade avatar ahmad-hamade commented on July 18, 2024 1

I would suggest updating the command terraform init here and pass -upgrade=true so it will redownload the plugins again if they are corrupted

init_output=$(terraform init -backend=false -upgrade=true 2>&1)

from pre-commit-terraform.

antonbabenko avatar antonbabenko commented on July 18, 2024

Hi @zacharyabresch !

v1.25.0 of pre-commit-terraform has been just released after #77 was merged. This should make terraform_tflint usable for you. Check comments for passing arguments in #76 for some examples.

from pre-commit-terraform.

tpdownes avatar tpdownes commented on July 18, 2024

I am using v1.25.0 and, outwardly, it looks the issue still exists for that. I think the CWD of the terraform validate command has to be the subdirectory and I'm guessing that ins't how it is exec'd within the shell script that implements the hook.

from pre-commit-terraform.

zacharyabresch avatar zacharyabresch commented on July 18, 2024

I finally got a chance to hook this up and tflint worked flawlessly this time. Thanks for the update and effort!

from pre-commit-terraform.

barryib avatar barryib commented on July 18, 2024

@zacharyabresch can we close this issue ?

from pre-commit-terraform.

antonbabenko avatar antonbabenko commented on July 18, 2024

terraform_validate hook has been just updated in #100, and v1.29.0 is now released. Please give it a try!

from pre-commit-terraform.

ghostsquad avatar ghostsquad commented on July 18, 2024

I don't think this is fixed. I just installed v1.29.0 and I'm seeing lots of:

Error: Module not installed

for terraform validate

from pre-commit-terraform.

nidr0x avatar nidr0x commented on July 18, 2024

@ghostsquad Same behaviour in my case

from pre-commit-terraform.

yashbhutwala avatar yashbhutwala commented on July 18, 2024

Ping! Still facing this issue for both terraform_validate and terraform_tflint. Any known workarounds for running terraform init for all sub-directories?

from pre-commit-terraform.

yashbhutwala avatar yashbhutwala commented on July 18, 2024

I just realized terraform_validate only did not work the first time (when all subfolders had no .terraform folders). It worked after the first time.

from pre-commit-terraform.

antonbabenko avatar antonbabenko commented on July 18, 2024

I have released an updated version (v1.44.0 ) where terraform_validate runs if no .terraform folder found.

See #158 and updated README.md file.

terraform-aws-modules/terraform-aws-lambda#68 - here you can see how I use both terraform_validate and terraform_tflint.

from pre-commit-terraform.

yashbhutwala avatar yashbhutwala commented on July 18, 2024

To be fair, I was already using v1.44.0 version and still ran into the first time problem.

from pre-commit-terraform.

antonbabenko avatar antonbabenko commented on July 18, 2024

It may be that .terraform folder was not correct. See note in point 3 here.

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.