TA-002-P · Question #350
Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files without changing their contents.
The correct answer is B. False. False. Running 'terraform fmt' without any flags rewrites Terraform configuration files in place to match the canonical style. It DOES modify file contents. To only check formatting without making changes (useful in CI pipelines), you must use the '-check' flag: 'terraform fmt…
Question
Running terraform fmt without any flags in a directory with Terraform configuration files will check the formatting of those files without changing their contents.
Options
- ATrue
- BFalse
How the community answered
(33 responses)- A12% (4)
- B88% (29)
Explanation
False. Running 'terraform fmt' without any flags rewrites Terraform configuration files in place to match the canonical style. It DOES modify file contents. To only check formatting without making changes (useful in CI pipelines), you must use the '-check' flag: 'terraform fmt -check'. This exits with a non-zero status code if any files are not properly formatted, without altering them.
Topics
Community Discussion
No community discussion yet for this question.