Forrest logo
back to the terraform tool

terraform-fmt:tldr:5caa4

terraform-fmt: Display diffs of formatting changes.
$ terraform fmt -diff
try on your machine

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.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the terraform tool