Forrest logo
back to the terraform tool

terraform-fmt:tldr:d58b5

terraform-fmt: Format the configuration in the current directory and subdirectories.
$ terraform fmt -recursive
try on your machine

The command terraform fmt -recursive is used in the Terraform infrastructure as code (IAC) tool to format Terraform configuration files (.tf files) in a recursive manner.

Here's a breakdown of the components of this command:

  • terraform: The Terraform command-line interface (CLI) used to interact with Terraform.
  • fmt: A subcommand of the Terraform CLI used to format Terraform configuration files. It ensures that the files follow a standardized code style and formatting for improved readability and consistency.
  • -recursive: An optional flag that specifies that formatting should be recursively applied to all the subdirectories and files present in the current directory.

When this command is executed, it formats the .tf files in the current directory and any subdirectories, helping maintain a clean and consistent codebase.

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