terraform fmt

From wikieduonline
Revision as of 11:51, 30 May 2024 by Welcome (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

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

Related commands

See also

  • https://www.terraform.io/docs/cli/commands/fmt.html
  • Advertising: