Editing Terraform fmt

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
{{lowercase}}
 
{{lowercase}}
<code>terraform fmt</code> command is used to rewrite Terraform configuration files to a canonical format and style. <ref>https://www.terraform.io/docs/cli/commands/fmt.html</ref>
+
<code>terraform fmt</code> command is used to rewrite Terraform configuration files to a canonical format and style.
 +
* https://www.terraform.io/docs/cli/commands/fmt.html  
  
[[terraform fmt --help]]
+
  [[terraform fmt -diff]]
  [[terraform fmt -diff]] Display diffs of formatting changes
 
 
  [[terraform fmt -check]]
 
  [[terraform fmt -check]]
[[terraform fmt -recursive]]
 
 
  [[terraform fmt -write -recursive]]
 
  [[terraform fmt -write -recursive]]
[[terraform fmt -check -recursive -diff]]
 
  
 
== Examples ==
 
== Examples ==
 +
[[terraform]] fmt
 +
(no output)
  
Scan .tf files in your current directory:
 
:<code>[[terraform]] fmt</code>
 
:<code>(no output)</code>
 
 
 
<code>main.tf</code> has been formated:
 
 
  terraform fmt
 
  terraform fmt
 
  [[main.tf]]
 
  [[main.tf]]
Line 24: Line 18:
 
  [[variables.tf]]
 
  [[variables.tf]]
  
[[terraform fmt -check]]
+
* <code>[[terraform fmt -check]]</code>
(no output)
+
:(no output)
 
 
:<code>[[terraform]] fmt FileToScan.tf</code>
 
:FileToScan.tf
 
  
== Activities ==
+
* <code>[[-diff]]</code> - Display diffs of formatting changes
* Use <code>[[vimdiff]], [[icdiff]]</code> or [[set list]] in vim to identify [[lines with a single space]] on it.
 
  
 
== Related commands ==
 
== Related commands ==
 +
* <code>[[go fmt]]</code> and [[import "fmt"]]
 
* <code>[[cfn-lint]]</code>
 
* <code>[[cfn-lint]]</code>
 +
* [[Linter]]
 
* <code>[[terraform validate]]</code>
 
* <code>[[terraform validate]]</code>
 
* <code>[[terraform apply]]</code>
 
* <code>[[terraform apply]]</code>
 
* [[Terraform Style Conventions]]
 
* [[Terraform Style Conventions]]
* <code>[[terragrunt fmt]]</code>
+
* [[terragrunt fmt]]
* <code>[[Warning: Interpolation-only expressions are deprecated]]</code>
+
[[Warning: Interpolation-only expressions are deprecated]]
* <code>[[.pre-commit-config.yaml]]</code>
 
* <code>[[terraform --version]]</code>
 
* <code>[[set list]]</code>
 
* [[vimdiff]]
 
* [[icdiff]]
 
  
 
== See also ==
 
== See also ==
 +
* {{fmt}}
 
* {{terraform fmt}}
 
* {{terraform fmt}}
 +
* {{terraform cmd}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Templates used on this page:

Advertising: