terraform fmt
terraform fmt
command is used to rewrite Terraform configuration files to a canonical format and style. [1]
terraform fmt --help terraform fmt -diff Display diffs of formatting changes terraform fmt -check terraform fmt -recursive terraform fmt -write -recursive terraform fmt -check -recursive -diff
Examples
Scan .tf files in your current directory:
terraform fmt
(no output)
terraform fmt main.tf
terraform fmt main.tf variables.tf
terraform fmt -check (no output)
terraform fmt FileToScan.tf
- FileToScan.tf
Related commands
cfn-lint
terraform validate
terraform apply
- Terraform Style Conventions
terragrunt fmt
Warning: Interpolation-only expressions are deprecated
.pre-commit-config.yaml
- terraform --version
- set list
See also
terraform fmt [ -diff | -check | validate | --help ]
Advertising: