terraform tomap() requires some care when using it
Terraform tomap function requires the object to have the same schema otherwise it will give you the following error │ on main.tf line 14, in resource "null_resource" "from_yaml_files": │ 14: for_each = tomap(local.yaml_data) │ ├──────────────── │ │ while calling tomap(v) │ │ local.yaml_data is object with 3 attributes │ │ Invalid value for "v" parameter: cannot convert object to map of any single type. Let's see what that looks like in yaml - if you're loading 3 files and all of them have the following - that's great! happy days. But if you have somehing that looks different --- name : DisabledApp version : 0.5 enabled : false environment : development items : - id : 1 type : test name : test-service port : 7000 different like this --- name : DisabledApp version : 0.5 enabled : false environment : development items : - id : 1 ...