I have next list:
local {
...
step_scaling_out_policy_configuration = {
"adjustment_type" = "ChangeInCapacity"
"cooldown" = 300
"metric_aggregation_type" = "Maximum"
"step_adjustment" = {
"metric_interval_lower_bound" = 0
"scaling_adjustment" = 1
}
}
...
}
And I could transform into block using next logic:
step_scaling_policy_configuration {
adjustment_type = local.step_scaling_out_policy_configuration.adjustment_type
cooldown = local.step_scaling_out_policy_configuration.cooldown
metric_aggregation_type = local.step_scaling_out_policy_configuration.metric_aggregation_type
step_adjustment {
metric_interval_lower_bound = local.step_scaling_out_policy_configuration.step_adjustment.metric_interval_lower_bound
scaling_adjustment = local.step_scaling_out_policy_configuration.step_adjustment.scaling_adjustment
}
}
It's quite easy with fixed number of keys in map. But is it possible to dynamically generate such block because I don't know exactly what could be in local.step_scaling_out_policy_configuration
map. Now supposing I have
local {
...
step_scaling_out_policy_configuration = {
"adjustment_type" = "ChangeInCapacity"
"cooldown" = 300
"metric_aggregation_type" = "Maximum"
#######
"some_new_key" = "value"
#######
"step_adjustment" = {
"metric_interval_lower_bound" = 0
"scaling_adjustment" = 1
}
}
...
}
Obviously with previous logic I won't have some_new_key
parameter in step_scaling_policy_configuration
block. Is it possible to add key to step_scaling_policy_configuration
block dynamically based on what's inside of local.step_scaling_out_policy_configuration
map?