Rationale for Correct Answer: terraform fmt automatically rewrites .tf files to match Terraform’s canonical formatting (indentation, spacing, alignment conventions). This is the standard tool for enforcing consistent style across a team.
Analysis of Incorrect Options (Distractors):
B: Insufficient—formatting is more than tabs vs spaces; terraform fmt handles the full HCL style.
C: terraform validate checks syntax and internal consistency, not formatting.
D: Terraform does not auto-format configuration during apply.
Key Concept: Standardizing HCL formatting with terraform fmt.
[Reference: Terraform Objectives — Read, Generate, and Modify Configurations (formatting and configuration authoring), Understand Terraform Basics and CLI (core CLI commands)., , ]
Submit