Skip to content

Commit c744dbf

Browse files
committed
make replacements dynamic for bicep
1 parent 05b61a7 commit c744dbf

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

modules/file_manipulation/locals.bicep.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ locals {
1919
}
2020
}
2121

22-
bicep_module_file_replacements = {
23-
management_subscription_id = try(var.subscription_ids["management"], "")
24-
connectivity_subscription_id = try(var.subscription_ids["connectivity"], "")
25-
identity_subscription_id = try(var.subscription_ids["identity"], "")
26-
security_subscription_id = try(var.subscription_ids["security"], "")
27-
primary_location = try(local.bicep_parameters.LOCATION_PRIMARY, "eastus")
28-
secondary_location = try(local.bicep_parameters.LOCATION_SECONDARY, "westus")
29-
root_parent_management_group_id = var.root_parent_management_group_id
22+
bicep_module_file_dynamic_replacements = { for flattened_result in flatten([ for key, value in local.starter_module_config.inputs :
23+
[ for target in value.targets : {
24+
key = key
25+
value = local.bicep_parameters[target.Name]
26+
} if target.Destination == "Environment" ]
27+
]) : flattened_result.key => flattened_result.value
28+
}
29+
30+
bicep_module_file_replacements = merge({
3031
unique_postfix = var.resource_names.unique_postfix
3132
time_stamp = var.resource_names.time_stamp
3233
time_stamp_formatted = var.resource_names.time_stamp_formatted
33-
intermediate_root_management_group_id = try(local.bicep_parameters.INTERMEDIATE_ROOT_MANAGEMENT_GROUP_ID, "alz")
34-
}
34+
}, local.bicep_module_file_dynamic_replacements)
3535
}
3636

3737
locals {

0 commit comments

Comments
 (0)