Which of the following commands would you use to rewrite all .tf files in the current directory to conform to Terraform's canonical style without making any logical changes to the configuration?
- A.
terraform validate - B.
terraform lint - C.
terraform fmt✓ Correct - D.
terraform refresh
Explanation
Correct: C. terraform fmt rewrites Terraform configuration files in the current directory to the canonical HCL style (indentation, alignment, spacing) without altering the logical meaning of the configuration. A is wrong — terraform validate checks configuration syntax and internal consistency but does NOT reformat files. B is wrong — terraform lint is not a built-in Terraform command; third-party tools like tflint exist but are not part of the core CLI. D is wrong — terraform refresh updates the Terraform state file to match the real-world infrastructure state; it does not touch source files.