terraform fmt

Category: IaC & Automation

terraform fmt

Format configuration files to canonical style

Rewrites HCL configuration files (tf, tfvars) in the current directory to HashiCorp's canonical style, aligning indentation and spacing. Run it before committing so diffs stay readable, and use -check in CI to fail on unformatted files. Related: terraform fmt -recursive, terraform validate.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.