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?
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?
When writing Terraform code that adheres to the Terraform style conventions, each nesting level should be indented two spaces compared to the level above it. This standard helps ensure consistency and readability in the code. Adhering to this convention allows Terraform files to be easily readable and manageable across different teams and projects.
D is correct answer: Indent two spaces for each nesting level. https://www.terraform.io/language/syntax/style#style-conventions
Answer D for sure
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.
dont paste chat gpt answers
"Compared to one above" .. not the parent
definitely D
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:
2 spaces. Answer is D