0.5.0 Add `map_configs` variable
what
- Add
map_configs
variable
why
map_configs
variable is a list of existing configurations of map type. Deep-merging of the existing map configs takes precedence over the map configs loaded from YAML files- Allow deep-merging of Terraform maps without loading them from YAML files (e.g. when using stack configs from other modules, we need to deep-merge
vars
sections from different parts of YAML files) - Allow re-using the third-party
deepmerge
from other modules when they already useterraform-yaml-config
(since Terraform does not support deep-merging natively) - and not copying thedeepmerge
module into every other module that need deep-merging
test
Input
map_config_paths = [
"map-configs/*.yaml"
]
map_configs = [
{
key3 = {
name = "name3_override"
param = "param3_override"
},
key4 = {
name = "name4"
param = "param4"
type = "type4"
},
key5 = {
name = "name5"
param = ["param5a", "param5b"]
type = "type5"
}
},
{
key6 = {
name = "name6"
param = "param6"
type = "type6"
},
key1 = [
{
name = "name1_override"
param = "param1_override"
}
]
}
]
Output
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
map_configs = {
"key1" = [
{
"name" = "name1_override"
"param" = "param1_override"
},
]
"key2" = [
{
"name" = "name2"
"param" = "2"
"type" = "type2"
},
]
"key3" = {
"name" = "name3_override"
"param" = "param3_override"
"type" = "type3"
}
"key4" = {
"name" = "name4"
"param" = "param4"
"type" = "type4"
}
"key5" = {
"name" = "name5"
"param" = [
"param5a",
"param5b",
]
"type" = "type5"
}
"key6" = {
"name" = "name6"
"param" = "param6"
"type" = "type6"
}