nerdexam
HashiCorpHashiCorp

TERRAFORM-ASSOCIATE-004 · Question #59

TERRAFORM-ASSOCIATE-004 Question #59: Real Exam Question with Answer & Explanation

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 aws_s

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.

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 PracticeBrowse All TERRAFORM-ASSOCIATE-004 Questions