Overview
- Construct repeated nested blocks
- Valid in resource, data, provider and provisioner blocks
- e.g.
resource "foo" "example" {
#...
dynamic "settings" {
for_each = var.settings
content {
name = settings.value["name"]
#...
}
}
}
- Can specify an iterator nameādefaults to the name of the dynamic block:
resource "foo" "example" {
#...
dynamic "settings" {
for_each = var.settings
iterator = "bar"
content {
name = bar.value["name"]
#...
}
}
}