What is an example of an error that tflint will catch that `terraform init` will not error on?



  • I am trying to test a pipeline change that will run tflint automatically, but I'm struggling to find an example of an error that won't prevent terraform init from completing without errors but will be caught by tflint --module. My goal is to prove that tflint is running is running in the pipeline and will fail any pipeline that finds linting errors. Any ideas?

    I know there must be lots of examples, or tflint wouldn't exist - but I'm not running across them right now.

    Examples of things I've tried so far: tflint doesn't catch white space or using dashes when underlines are more 'correct' (or is this a config issue on my part?), terraform init doesn't tolerate single quotes or misnamed modules.



  • These are the default https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/docs/rules/README.md for tflint. Most of these rules will have an example of how to trigger it and remediate it. A simple one you could use is the terraform_comment_syntax https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/docs/rules/terraform_comment_syntax.md .

    You can trigger it by using a // comment inside a *.tf file.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2