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

feature request: terraform lint #1121

Closed
pmoust opened this issue Mar 5, 2015 · 6 comments
Closed

feature request: terraform lint #1121

pmoust opened this issue Mar 5, 2015 · 6 comments

Comments

@pmoust
Copy link
Contributor

pmoust commented Mar 5, 2015

This has been mentioned before, Github search fails me though.

I think a lot of terraform adopters would love a terraform lint command to keep things standardized.

It doesn't need to be as advanced as gofmt that takes actions (though that would be very cool(, a mild linter like Puppet's would be great.

@josephholsten
Copy link
Contributor

@pmoust this seems relevant to your interests: hashicorp/hcl#24

@apparentlymart
Copy link
Contributor

A round-trip from HCL to JSON and back would not quite be equivalent to go fmt because it would lose non-machine-significant stuff like comments, resource ordering and whitespace intentionally left to communicate organization.

I think to implement something like go fmt or even just a read-only linter it would be necessary to go down to the level of the lexer in the HCL library and interpret the raw token stream in a different way than the HCL parser normally does, possibly modifying it a little to retain comments and whitespace in the token stream. Thus I think such a thing would end up being largely an HCL change rather than a Terraform change, with just a little bit of UI work in Terraform to make your terraform lint command work.

@pmoust
Copy link
Contributor Author

pmoust commented Nov 3, 2015

Implemented by @fatih at https://github.com/fatih/hclfmt
(vim plugin provided as as well at: https://github.com/fatih/vim-hclfmt)
works great

@pmoust pmoust closed this as completed Nov 3, 2015
@pmoust
Copy link
Contributor Author

pmoust commented Nov 3, 2015

Formatting discussion at https://github.com/fatih/hcl/issues/1

@davewongillies
Copy link
Contributor

Just for anyone who stumbles across this and isn't familiar with the tool, there's tflint these days which can fill this gap: https://github.com/wata727/tflint

@ghost
Copy link

ghost commented Apr 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants