@@ -6,10 +6,26 @@ locals {
66 networking_type = local. is_bicep_iac_type ? try (local. bicep_parameters . network_type , local. bicep_parameters . networkType ) : " "
77}
88
9+ output "test" {
10+ value = local. bicep_module_files_defaults_found
11+ }
12+
13+ locals {
14+ bicep_module_files_defaults_found = distinct (flatten ([for key , value in local . module_files_filtered : [
15+ for template in regexall (" (\\ {\\ {[\\ s]*.*?[\\ s]*\\ }\\ })" , value. content ) :
16+ replace (replace (template[0 ], " {{" , " " ), " }}" , " " ) if length (template) > 0 && strcontains (template[0 ], " ||" )
17+ ] if endswith (key, " .bicepparam" )
18+ ]))
19+
20+ bicep_module_files_defaults = { for item in local . bicep_module_files_defaults_found :
21+ (split (" ||" , item)[0 ]) => split (" ||" , item)[1 ]
22+ }
23+ }
24+
925locals {
1026 bicep_module_files_prepped_for_templating = { for key , value in local . module_files_filtered : key =>
1127 {
12- content = replace (replace (replace (value. content , " $${" , " $$${" ), " {{" , " $${" ), " }}" , " }" )
28+ content = replace (replace (replace (replace ( value. content , " /( \\ | \\ |[ \\ s]*.*?[ \\ s]* \\ } \\ })/ " , " }} " ) , " $${" , " $$${" ), " {{" , " $${" ), " }}" , " }" )
1329 } if endswith (key, " .bicepparam" )
1430 }
1531
@@ -23,7 +39,9 @@ locals {
2339 unique_postfix = var.resource_names.unique_postfix
2440 time_stamp = var.resource_names.time_stamp
2541 time_stamp_formatted = var.resource_names.time_stamp_formatted
26- }, local. bicep_parameters )
42+ },
43+ local. bicep_module_files_defaults ,
44+ local. bicep_parameters )
2745}
2846
2947locals {
0 commit comments