TERRAFORM-ASSOCIATE-004 · Question #14
What is the Terraform style convention for indenting a nesting level compared to the one above it?
The correct answer is B. With two spaces. The official Terraform style conventions, documented in the HashiCorp style guide, specify that each nesting level should be indented by two spaces relative to its parent block. Tabs are not used (A). Four spaces (C) is the Python convention but not Terraform's. Three spaces (D)
Question
Options
- AWith a tab
- BWith two spaces
- CWith four spaces
- DWith three spaces
How the community answered
(37 responses)- A5% (2)
- B89% (33)
- C3% (1)
- D3% (1)
Explanation
The official Terraform style conventions, documented in the HashiCorp style guide, specify that each nesting level should be indented by two spaces relative to its parent block. Tabs are not used (A). Four spaces (C) is the Python convention but not Terraform's. Three spaces (D) is non-standard. Consistent use of two-space indentation is enforced by terraform fmt, which automatically reformats configuration files to comply with the style guide.
Topics
Community Discussion
No community discussion yet for this question.