Skip to content
Captain's Academy0
← Terraform sea chart
Island 2 · HCL basics · Port 2.5

terraform fmt and style

Ask the Captain
Instagram
Two spaces or four? Terraform settles it for you.
You'll learn to

format code with terraform fmt (-check, -recursive) and follow the naming and style conventions

Recap

  1. 1terraform fmt rewrites the layout: 2-space indent, = signs aligned
  2. 2-check (for CI, changes nothing) · -diff · -recursive
  3. 3fmt never checks validity: that's terraform validate
Check yourself

Which command fails a CI build when files aren't formatted, without changing them?

2.5

Stamp this lesson

Watched it and passed the check? Mark it in your logbook.