terraform fmt
terraform fmt
command is used to rewrite Terraform configuration files to a canonical format and style.
terraform fmt -diff terraform fmt -check terraform fmt -write -recursive
Examples
terraform fmt (no output)
terraform fmt main.tf
terraform fmt main.tf variables.tf
- (no output)
-diff
- Display diffs of formatting changes
Related commands
go fmt
and import "fmt"cfn-lint
- Linter
terraform validate
terraform apply
- Terraform Style Conventions
- terragrunt fmt
Warning: Interpolation-only expressions are deprecated
.pre-commit-config.yaml
See also
- fmt:
go fmt, terraform fmt, terragrunt hclfmt
terraform fmt [ -diff | -check | validate | --help ]
Advertising: