Difference between revisions of "Terraform fmt"

From wikieduonline
Jump to navigation Jump to search
Line 24: Line 24:
 
  [[terraform fmt -check]]
 
  [[terraform fmt -check]]
 
  (no output)
 
  (no output)
 +
 +
:<code>[[terraform]] fmt FileToScan.tf</code>
 +
:FileToScan.tf
  
 
== Related commands ==
 
== Related commands ==

Revision as of 12:27, 20 December 2023

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

See also

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