How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?

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?
A . Run the terraform fmt command during the code linting phase of your CI/CD process
B . Designate one person in each team to review and format everyone’s code
C . Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
D . Write a shell script to transform Terraform files using tools such as AWK, Python, and sed

Answer: C

Explanation:

Indent two spaces for each nesting level.

When multiple arguments with single-line values appear on consecutive lines at the same nesting level, align their equals signs.

Reference: https://www.terraform.io/docs/language/syntax/style.html

Latest TA-002-P Dumps Valid Version with 324 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
2 Comments
Inline Feedbacks
View all comments
Sam
Sam
2 years ago

Why can`t we use Terraform fmt command?

Sam
Sam
2 years ago

Whay can`t we use Terraform fmt command?