Closed Smana closed 2 years ago
Try remove --args=--init
Try remove
--args=--init
Sorry I'll update the issue because I forgot to mention that most of the time this step is ran using a docker container.
Please, do not try create your own docker image if it not strictly required
Use this:
TAG=v1.74.1
docker run -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
https://github.com/antonbabenko/pre-commit-terraform#4-run
Otherwise, at least provide Dockerfile
Hi I understand your concerns about using our own docker image and I'll see if this is required. In the meantime I used the command you provided without success:
TAG=v1.74.1
docker run -v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
[INFO] This may take a few minutes...
Terragrunt fmt...........................................................Passed
Terraform fmt............................................................Passed
Terraform validate with tflint...........................................Passed
Check for merge conflicts................................................Passed
But digging further I noticed too mistakes:
--args=--init
wasn't necessary at the enddeep_check
requires AWS credentials, my badRemoving them did the trick, thanks for your help
Theoretically, that should help, if tflint does not requires aws
CLI for that.
TAG=v1.74.1
docker run \
-v "$HOME/.aws:/root/.aws" \
-v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
Or, which is better for CI
TAG=v1.74.1
AWS_ACCESS_KEY_ID=
AWS_ACCESS_KEY_ID=
AWS_REGION=
docker run \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_ACCESS_KEY_ID \
-e AWS_REGION=$AWS_REGION \
-v $(pwd):/lint -w /lint ghcr.io/antonbabenko/pre-commit-terraform:$TAG run -a
Describe the bug
I'm trying to use the
tflint
hook and I cannot get it work in a recursive mode. I didn't find the root cause yet.How can we reproduce it?
Here is the
.pre-commit-config.yaml
and the
.tflint.hcl
When I run the command from the root directory of the repository it doesn't throw any error.
If I run the tflint command from a test module as follows it works:
Environment information
Any help would be welcome, I'm probably missing something obvious to you :)