Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Terraform Associate All Questions

View all questions & answers for the Terraform Associate exam

Exam Terraform Associate topic 1 question 92 discussion

Actual exam question from HashiCorp's Terraform Associate
Question #: 92
Topic #: 1
[All Terraform Associate Questions]

If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one above it?

  • A. With four spaces
  • B. With a tab
  • C. With three spaces
  • D. With two spaces
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Eltooth
Highly Voted 2 years, 4 months ago
Selected Answer: D
D is correct answer: Indent two spaces for each nesting level. https://www.terraform.io/language/syntax/style#style-conventions
upvoted 14 times
...
Power123
Most Recent 1 year, 7 months ago
2 spaces. Answer is D
upvoted 1 times
...
aone
1 year, 8 months ago
The Terraform parser allows you some flexibility in how you lay out the elements in your configuration files, but the Terraform language also has some idiomatic style conventions which we recommend users always follow for consistency between files and modules written by different teams. Automatic source code formatting tools may apply these conventions automatically. Note: You can enforce these conventions automatically by running terraform fmt. 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:
upvoted 1 times
...
zecch
1 year, 8 months ago
definitely D
upvoted 1 times
...
Abhijeet2904
1 year, 9 months ago
Selected Answer: A
A. With four spaces When writing Terraform code that adheres to the Terraform style conventions, each nesting level should be indented four spaces compared to the level above it. This helps to visually distinguish between different levels of nesting and improves readability of the code. In Terraform, a common use case for nested blocks is to define resources that depend on other resources. For example, you might have a resource that creates a network security group, and then another resource that creates a virtual machine that references the network security group. In this case, the virtual machine resource would be indented four spaces compared to the network security group resource. Using four spaces for indentation is a widely accepted standard in the software development community, and it is recommended to use four spaces for indentation in Terraform code as well.
upvoted 1 times
David_C_90
1 year, 8 months ago
dont paste chat gpt answers
upvoted 5 times
...
alen995454
10 months, 2 weeks ago
"Compared to one above" .. not the parent
upvoted 1 times
...
...
vadeemkaa
1 year, 11 months ago
Answer D for sure
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...