HashiCorp Certified: Terraform Associate — Question 9

You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

Answer options

Correct answer: A

Explanation

The correct answer is A because running the terraform fmt command automatically formats Terraform files according to standard practices, ensuring consistency across the team. Options B and C rely on manual processes which are less efficient and prone to human error, while option D suggests using external tools that do not guarantee adherence to Terraform's formatting rules.