Looking for advise as to the best way to handle this. I’m creating a module that creates a documentDB database instance, and want to to use for-each or count to support creating several DB instances from a structure like this in the terragrunt.hcl file. I’m not sure if nodes should be a list(map(string)) or do it as a map(map(string)
inputs = {
nodes = [
{
cluster_identifier = “foo”
master_username = “foo”
master_password = “insecure”
backup_rention_period = 30
preferred_backup_window = “07:00-09:00”
}
{
cluster_identifier = “bar”
master_username = “fooo”
master_password = “insecure”
backup_rention_period = 30
preferred_backup_window = “07:00-09:00”
}
]
}
On the module side, trying to do something like this:
for_each = var.nodes
cluster_identifier = each.value.cluster_identifier
master_username = each.value.master_username
master_password = each.value.master_password
backup_retention_period = each.value.backup_rention_period
preferred_backup_window = each.value.preferred_backup_window
skip_final_snapshot = true
This isn’t working. I’d appreciate and feedback on what approach should be done to support this, I can see several cases where this would be useful.