nerdexam
HashiCorp

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…

Submitted by diego_uy· Apr 18, 2026Work with Terraform Configurations

Question

What type of block is used to construct a collection of nested configuration blocks?

Options

  • ADynamic
  • BFor_each
  • CNesting
  • Drepeated.

How the community answered

(55 responses)
  • A
    93% (51)
  • B
    4% (2)
  • C
    2% (1)
  • D
    2% (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

#Dynamic Blocks#HCL#Configuration Language#Nested Blocks

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice