Skill 3.7.1
terraform fmt and its options
Key Concepts
terraform fmt processes .tf, .tfvars and .tftest.hcl files in the current directory. It fixes indentation to two spaces, aligns the equals signs of consecutive arguments and normalizes spacing. It changes layout only, never meaning, and prints the names of the files it changed.
-recursive also processes subdirectories, which is needed for repositories with modules. -check changes nothing and exits with a non-zero status if any file needs formatting, which makes it a CI gate. -diff shows the changes, and -write=false prints the formatted output without writing it.