TERRAFORM-ASSOCIATE-004 · Question #59
What type of block is used to construct a collection of nested configuration blocks?
The correct answer is A. Dynamic. The dynamic block is used to construct a collection of repeated nested configuration blocks programmatically. It accepts an iterable (list or map) and generates one nested block per item, avoiding repetitive hardcoded blocks. For example, a dynamic "ingress" block inside an…
Question
Options
- ADynamic
- BFor_each
- CNesting
- Drepeated.
How the community answered
(55 responses)- A93% (51)
- B4% (2)
- C2% (1)
- D2% (1)
Explanation
The dynamic block is used to construct a collection of repeated nested configuration blocks programmatically. It accepts an iterable (list or map) and generates one nested block per item, avoiding repetitive hardcoded blocks. For example, a dynamic "ingress" block inside an aws_security_group resource can generate multiple ingress rules from a variable list. for_each is a meta-argument for iterating over resource or module instances, not for generating nested blocks within a single resource.
Topics
Community Discussion
No community discussion yet for this question.