HashiCorp
TA-002-P · Question #422
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?
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
How the community answered
(25 responses)- A4% (1)
- B4% (1)
- C8% (2)
- D84% (21)
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.