I have dynamic block on a variable.
dynamic "settings" {
for_each = var.settings
content {
id = lookup(settings.value, "id", null)
...
}
}
But from the calling module, it not necessary that settings to always exists and sometime it would just be passed null.
settings = null
However, when this happens I get following while planning.
var.settings is null
Cannot use a null value in for_each.
So basically, I only want to dynamic block generation when the settings is not null. How best can I address this?