HashiCorp
TERRAFORM-ASSOCIATE-004 · Question #171
You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?
The correct answer is D. Dynamic blocks. Dynamic blocks in Terraform allow you to define multiple nested blocks within a resource based on the values of a variable. This feature is particularly useful for scenarios where the number of nested blocks is not fixed and can change based on variable input.
Submitted by kevin_r· Apr 18, 2026Work with Terraform Configurations
Question
You want to define multiple data disks as nested blocks inside the resource block for a virtual machine. What Terraform feature would help you define the blocks using the values in a variable?
Options
- ALocal values
- BCount arguments
- CCollection functions
- DDynamic blocks
How the community answered
(22 responses)- A5% (1)
- B5% (1)
- D91% (20)
Explanation
Dynamic blocks in Terraform allow you to define multiple nested blocks within a resource based on the values of a variable. This feature is particularly useful for scenarios where the number of nested blocks is not fixed and can change based on variable input.
Topics
#Dynamic Blocks#Nested Blocks#Resource Configuration#Variables
Community Discussion
No community discussion yet for this question.