Difference between revisions of "Terraform fmt"
Jump to navigation
Jump to search
↑ https://www.terraform.io/docs/cli/commands/fmt.html
(3 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
[[terraform fmt --help]] | [[terraform fmt --help]] | ||
− | [[terraform fmt -diff]] | + | [[terraform fmt -diff]] Changes and display diffs of formatting changes |
[[terraform fmt -check]] | [[terraform fmt -check]] | ||
[[terraform fmt -recursive]] | [[terraform fmt -recursive]] | ||
Line 14: | Line 14: | ||
:<code>[[terraform]] fmt</code> | :<code>[[terraform]] fmt</code> | ||
:<code>(no output)</code> | :<code>(no output)</code> | ||
+ | |||
<code>main.tf</code> has been formated: | <code>main.tf</code> has been formated: | ||
Line 40: | Line 41: | ||
* <code>[[Warning: Interpolation-only expressions are deprecated]]</code> | * <code>[[Warning: Interpolation-only expressions are deprecated]]</code> | ||
* <code>[[.pre-commit-config.yaml]]</code> | * <code>[[.pre-commit-config.yaml]]</code> | ||
− | * [[terraform --version]] | + | * <code>[[terraform --version]]</code> |
− | * [[set list]] | + | * <code>[[set list]]</code> |
* [[vimdiff]] | * [[vimdiff]] | ||
* [[icdiff]] | * [[icdiff]] |
Latest revision as of 11:51, 30 May 2024
terraform fmt
command is used to rewrite Terraform configuration files to a canonical format and style. [1]
terraform fmt --help terraform fmt -diff Changes and display diffs of formatting changes terraform fmt -check terraform fmt -recursive terraform fmt -write -recursive terraform fmt -check -recursive -diff
Examples[edit]
Scan .tf files in your current directory:
terraform fmt
(no output)
main.tf
has been formated:
terraform fmt main.tf
terraform fmt main.tf variables.tf
terraform fmt -check (no output)
terraform fmt FileToScan.tf
- FileToScan.tf
Activities[edit]
- Use
vimdiff, icdiff
or set list in vim to identify lines with a single space on it.
Related commands[edit]
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
- vimdiff
- icdiff
See also[edit]
terraform fmt [ -diff | -check | validate | --help ]
Advertising: