Created
April 14, 2020 13:28
-
-
Save jcbagtas/231bf08afeecf0ec269296d033faafef to your computer and use it in GitHub Desktop.
Merge a variable List of Maps in Terraform 0.12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist mimics the supposed behavior of | |
# variable = merge(someListOfMaps[*].parameters...) | |
# or | |
# policy_parameters = merge(data.azurerm_policy_definition.d_policy_definitions[*].parameters...) | |
locals { | |
policy_parameters = [ | |
for key,value in data.azurerm_policy_definition.d_policy_definitions: | |
{ | |
parameters = jsondecode(value.parameters) | |
} | |
] | |
ph_parameters = local.policy_parameters[*].parameters | |
input_parameter = [for item in local.ph_parameters: merge(item,local.ph_parameters...)] | |
usage = local.input_parameter[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment