terraform-fmt:tldr:5caa4
The command terraform fmt -diff
is used in the Terraform infrastructure-as-code (IaC) tool.
-
terraform fmt
is a subcommand that formats Terraform configuration files based on a set of style guidelines. It helps maintain a consistent and readable format across different configurations, making it easier for developers to collaborate and understand the code. -
The
-diff
flag is an optional flag that tells Terraform to display a summary of detected changes after the formatting. It compares the original configuration with the formatted version, highlighting any modifications made during the formatting process.
By running terraform fmt -diff
, you can automatically format the Terraform configuration files and view a diff of the changes applied. This allows you to review and ascertain the modifications made by the formatting operation before committing the changes to version control.