Terraform fmt Command – How to Format Terraform Code
The `terraform fmt` command is used to format configuration files into a canonical format and style, ensuring consistency across all team members' work. It applies Terraform language style conventions and other adjustments for readability. Running this command each time a different version of Terraform is used is recommended. To ensure the `terraform fmt` command has been run on configuration files, it can be inserted into a CI/CD pipeline or automated checks can be set up using the `-check` option. The `-diff` option displays diffs of formatting changes, while the `-recursive` option processes files in subdirectories.
Company
Spacelift
Date published
Sept. 5, 2022
Author(s)
Jack Roper
Word count
991
Language
English
Hacker News points
None found.