HashiCorp Certified: Terraform Associate — Question 140

Multiple team members are collaborating on infrastructure using Terraform and want to format their Terraform code following standard Terraform-style convention. How could they automatically ensure the code satisfies conventions?

Answer options

Correct answer: A

Explanation

The correct answer is A because running the terraform fmt command automatically formats the code according to Terraform's style guidelines, making it easy to maintain consistency. Option B is incorrect as manual formatting is prone to errors and does not guarantee adherence to conventions. Option C, while useful for checking syntax and configuration, does not format the code.