Closed
Description
Describe the bug
tflint fails with errors about modules not being loaded like:
Error: `foo` module is not found. Did you run `terraform init`?
because it runs from the top directory of the repo
Commit 7c6ad7c refactored terraform_tflint.sh and part of that changed the execution of tflint to use the target directory, $path_uniq
, as an argument to tflint instead of using pushd
to change the working directory for the execution of tflint
.
How can we reproduce it?
Have a directory structure in your repository taht has the .prec-commit-config.yaml
at the top and one or more subdirectories with terraform files in them that use modules.
Environment information
- OS:
- Darwin Kernel Version 20.6.0
INSERT_OUTPUT_HERE
- Tools availability and versions:
❯ tflint --version
TFLint version 0.34.0
+ ruleset.aws (0.10.0-bundled)
.pre-commit-config.yaml
:
file content
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.62.0
hooks:
- id: terraform_fmt
- id: terragrunt_fmt
- id: terraform_tflint
- repo: local
hooks:
- id: autoupdate
name: pre-commit autoupdate
language: system
exclude: '.*'
always_run: true
entry: pre-commit
args: [autoupdate]