Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Add tflint #37

Closed
guidodobboletta opened this issue Mar 5, 2019 · 7 comments
Closed

Suggestion: Add tflint #37

guidodobboletta opened this issue Mar 5, 2019 · 7 comments

Comments

@guidodobboletta
Copy link
Contributor

It would be nice to add tflint to the checks (https://github.com/wata727/tflint)

@marcjay
Copy link

marcjay commented Apr 21, 2019

I wonder if it would be better to add support for pre-commit to the tflint project itself? i.e. add a .pre-commit-hooks.yaml. I'm tempted to raise a PR over there to add one

@antonbabenko
Copy link
Owner

@marcjay This repository is not related to tflint.

I agree with @guidodobboletta that it makes sense to have pre-commit hook which will run tflint as part of this repository.

PS: Pull request is welcome, of course.

@marcjay
Copy link

marcjay commented Apr 22, 2019

Sorry @antonbabenko I didn't mean to suggest that this repo was related to tflint - I appreciate that they're unrelated.

My question was more whether adding support for tflint to this repository is the right approach, as opposed to me/someone else raising a PR over on the tflint project to add support, using ansible-lint: https://github.com/ansible/ansible-lint/blob/master/.pre-commit-hooks.yaml and black: https://github.com/ambv/black/blob/master/.pre-commit-hooks.yaml as examples where support is added directly to the project, and not to a 'third party' project

Anyway from looking properly again at tflint, it seems there's about to be large breaking changes made to the project that are backed up behind Terraform 0.12 (terraform-linters/tflint#209) so it may make sense to hold off until tflint hits 0.8.0

@krzyzakp
Copy link
Contributor

@guidodobboletta and rest - on Sunday There was new version of tflint released: https://github.com/wata727/tflint/releases/tag/v0.8.3 - and it has support for pre-commit hooks built in. Feel free to use it directly, as this repo is not anymore compatible with TF v0.12 - I created PR for that couple days ago, but still no response.
In meantime, you can use my fork if you wish.

@robsonpeixoto
Copy link
Contributor

It uses the tflint's source code and because of that will need the go's compiler installed. IMHO this pre-commit should assume that the tflint's binary are installed and should be in another repository to not require download a big repository, @krzyzakp

@netflash
Copy link

netflash commented Jul 5, 2019

this is my way to use tflint

cat << EOF > /usr/bin/tflint
#!/usr/bin/env bash
docker run --rm -v \$(pwd):/data -t wata727/tflint \$@
EOF
chmod +x /usr/bin/tflint

It's more pre-commit friendly... kinda.

This is tflint.sh in pre-commit

#!/usr/bin/env bash

for file in "$@"; do
  tflint $file
done

@antonbabenko
Copy link
Owner

Thanks everyone involved and @costingalan for writing the code!

v1.19.0 has been released.

PS: I apologize for the delay, but summer break is over now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants