HashiCorp
TERRAFORM-ASSOCIATE-004 · Question #12
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
The correct answer is C. terraform fmt -check -recursive. This command will check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes, and will return a non-zero exit code if any files need formatting. The other commands will either make changes, list the files that need
Submitted by yousef_jo· Apr 18, 2026Use Terraform CLI
Question
Which command should you run to check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes?
Options
- Aterraform fmt -write-false
- Bterraform fmt -list -recursive
- Cterraform fmt -check -recursive
- Dterraform fmt -check
How the community answered
(26 responses)- A8% (2)
- B4% (1)
- C85% (22)
- D4% (1)
Explanation
This command will check if all code in a Terraform configuration that references multiple modules is properly formatted without making changes, and will return a non-zero exit code if any files need formatting. The other commands will either make changes, list the files that need formatting, or not check the modules.
Topics
#terraform fmt#code formatting#CLI options#multi-module configurations
Community Discussion
No community discussion yet for this question.