I'm hoping there is something to pick up when I have misspelled variables and comments to save me some time when I'm checking my code and reduce the potential for any errors.

I normally use IntelliJ IDE for Terraform on a MAC but also have VS code set up that I can use.

Is there a plugin for either I could use or even a different tool? I imaging variable might be difficult to lint due as I use underscores to separate words in my variable names so the tool would need to know to treat underscores as white space for linting purposes.


4 Answers 4


terraform fmt

The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style.

  • 1
    I already use that.
    – doug
    Dec 6, 2020 at 21:34
  • Thanks anyway though. I'm after something to spell check for me. I use terraform fmt to formate run terraform plan to check it should run. But for spelling, I currently do git compare with branch then look through each bit I changed and copy all my comments and variable names I'm not 100% sure about to word and change any seportors for spaces then see if anything gets highlighted. It's just really not a time-efficient process for that part of it.
    – doug
    Dec 6, 2020 at 21:46
  • @doug it might be easier using an IDE that has spell check (or a plugin thereof). Dec 9, 2020 at 21:00
  • The issue I had when I last tried that in VS code was the spell check plugin I used thought all the resources were misspelled as it couldn't pick out words separated by underscores. So I need it to treat - . and _ as if they were spaces so it can tell if the words separated by them are spelled correctly.
    – doug
    Dec 11, 2020 at 8:06
  • 1
    Sorry but this is not linting, this is putting something in canonical format as stated but it is not a linter Jul 13, 2021 at 10:39

The tools that we have include in our Terraform pipelines to check code quality and best practises are;

  1. Tflint
  2. TFSec
  3. Checkov

This way any issues get highlighted early at the MR stage.

  • 1
    this is the correct answer Jul 13, 2021 at 10:39
  • 1
    you can also hook all these up with pre-commit, which is a really nice way to check a commit each time :) Jul 13, 2021 at 10:41

VSCode has a Terraform Linter "l2fprod.terraform-fork" Have NOT tried it. Did a simple search terra + lint. HTH DrewBai


You can use tflint project. It has lot of plugins for cloud providers. https://github.com/terraform-linters/tflint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.