October 17, 2024

Lately, I’ve seen quite a bit of Terraform snippets that use a static map of maps to directly configure resources.
For example:
locals { map_of_maps = { name1 = { attribute1 = "name1-value1" attribute2 = "name1-value2" attribute3 = "name1-value3" } name2 = { attribute1 = "name2-value1" attribute2 = "name2-value2" attribute3 = "name2-value3" } name3 = { attribute1 = "name3-value1" attribute2 = "name3-value2" attribute3 = "name3-value3" } } } resource "some_resource" "this" { for_each = local. Source