HashiCorpHashiCorp
TA-002-P · Question #422
TA-002-P Question #422: Real Exam Question with Answer & Explanation
The correct answer is D: A dynamic block. A dynamic block acts much like a for expression, but produces nested blocks instead of a complex typed value. It iterates over a given complex value, and generates a nested block for each element of that complex value.
Read, generate, and modify configuration
Question
You need to write some Terraform code that adds 42 firewall rules to a security group as shown in the example. What can you use to avoid writing 42 different nested ingress config blocks by hand?
Options
- AA count loop
- BA for block
- CA for each block
- DA dynamic block
Explanation
A dynamic block acts much like a for expression, but produces nested blocks instead of a complex typed value. It iterates over a given complex value, and generates a nested block for each element of that complex value.
Topics
#Dynamic blocks#Terraform configuration#Nested blocks#Iteration
Community Discussion
No community discussion yet for this question.