@@ -21,16 +21,16 @@ module "networking" {
2121 for_each = local. networking . vnets
2222
2323 application_security_groups = local. combined_objects_application_security_groups
24- base_tags = try (local. global_settings . inherit_tags , false ) ? local. resource_groups [each . value . resource_group_key ]. tags : {}
24+ base_tags = try (local. global_settings . inherit_tags , false ) ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. tags : {}
2525 client_config = local. client_config
2626 ddos_id = try (azurerm_network_ddos_protection_plan. ddos_protection_plan [each . value . ddos_services_key ]. id , " " )
2727 diagnostics = local. combined_diagnostics
2828 global_settings = local. global_settings
29- location = lookup (each. value , " region" , null ) == null ? local. resource_groups [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
29+ location = lookup (each. value , " region" , null ) == null ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
3030 network_security_groups = module. network_security_groups
3131 network_security_group_definition = local. networking . network_security_group_definition
3232 network_watchers = try (local. combined_objects_network_watchers , null )
33- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
33+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
3434 route_tables = module. route_tables
3535 settings = each. value
3636 tags = try (each. value . tags , null )
@@ -60,8 +60,8 @@ module "public_ip_addresses" {
6060 for_each = local. networking . public_ip_addresses
6161
6262 name = azurecaf_name. public_ip_addresses [each . key ]. result
63- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
64- location = lookup (each. value , " region" , null ) == null ? local. resource_groups [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
63+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
64+ location = lookup (each. value , " region" , null ) == null ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
6565 sku = try (each. value . sku , " Basic" )
6666 allocation_method = try (each. value . allocation_method , " Dynamic" )
6767 ip_version = try (each. value . ip_version , " IPv4" )
@@ -79,7 +79,7 @@ module "public_ip_addresses" {
7979 )
8080 diagnostic_profiles = try (each. value . diagnostic_profiles , {})
8181 diagnostics = local. combined_diagnostics
82- base_tags = try (local. global_settings . inherit_tags , false ) ? local. resource_groups [each . value . resource_group_key ]. tags : {}
82+ base_tags = try (local. global_settings . inherit_tags , false ) ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. tags : {}
8383}
8484
8585
@@ -139,11 +139,11 @@ module "route_tables" {
139139 for_each = local. networking . route_tables
140140
141141 name = azurecaf_name. route_tables [each . key ]. result
142- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
143- location = lookup (each. value , " region" , null ) == null ? local. resource_groups [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
142+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
143+ location = lookup (each. value , " region" , null ) == null ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
144144 disable_bgp_route_propagation = try (each. value . disable_bgp_route_propagation , null )
145145 tags = try (each. value . tags , null )
146- base_tags = try (local. global_settings . inherit_tags , false ) ? local. resource_groups [each . value . resource_group_key ]. tags : {}
146+ base_tags = try (local. global_settings . inherit_tags , false ) ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. tags : {}
147147}
148148
149149resource "azurecaf_name" "routes" {
@@ -163,17 +163,17 @@ module "routes" {
163163 source = " ./modules/networking/routes"
164164 for_each = local. networking . azurerm_routes
165165
166- name = azurecaf_name. routes [each . key ]. result
167- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
168- route_table_name = module. route_tables [each . value . route_table_key ]. name
169- address_prefix = each. value . address_prefix
170- next_hop_type = each. value . next_hop_type
171- next_hop_in_ip_address = try (lower (each. value . next_hop_type ), null ) == " virtualappliance" ? try (each. value . next_hop_in_ip_address , null ) : null
166+ name = azurecaf_name. routes [each . key ]. result
167+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
168+ route_table_name = module. route_tables [each . value . route_table_key ]. name
169+ address_prefix = each. value . address_prefix
170+ next_hop_type = each. value . next_hop_type
171+ next_hop_in_ip_address = try (lower (each. value . next_hop_type ), null ) == " virtualappliance" ? try (each. value . next_hop_in_ip_address , null ) : null
172172 next_hop_in_ip_address_fw = try (lower (each. value . next_hop_type ), null ) == " virtualappliance" ? coalesce (
173173 try (local. combined_objects_azurerm_firewalls [try (each. value . private_ip_keys . azurerm_firewall . lz_key , local. client_config . landingzone_key )][each . value . private_ip_keys . azurerm_firewall . key ]. ip_configuration [each . value . private_ip_keys . azurerm_firewall . interface_index ]. private_ip_address , null ),
174174 try (local. combined_objects_azurerm_firewalls [try (each. value . lz_key , local. client_config . landingzone_key )][each . value . private_ip_keys . azurerm_firewall . key ]. ip_configuration [each . value . private_ip_keys . azurerm_firewall . interface_index ]. private_ip_address , null )
175175 ) : null
176-
176+
177177}
178178
179179#
@@ -199,9 +199,9 @@ resource "azurerm_network_ddos_protection_plan" "ddos_protection_plan" {
199199 for_each = local. networking . ddos_services
200200
201201 name = azurecaf_name. ddos_protection_plan [each . key ]. result
202- location = lookup (each. value , " region" , null ) == null ? local. resource_groups [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
203- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
204- tags = try (local. global_settings . inherit_tags , false ) ? merge (local. resource_groups [each . value . resource_group_key ]. tags , each. value . tags ) : try (each. value . tags , null )
202+ location = lookup (each. value , " region" , null ) == null ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
203+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
204+ tags = try (local. global_settings . inherit_tags , false ) ? merge (local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. tags , each. value . tags ) : try (each. value . tags , null )
205205}
206206
207207#
@@ -213,10 +213,10 @@ module "network_watchers" {
213213 source = " ./modules/networking/network_watcher"
214214 for_each = local. networking . network_watchers
215215
216- resource_group_name = local. resource_groups [each . value . resource_group_key ]. name
217- location = lookup (each. value , " region" , null ) == null ? local. resource_groups [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
216+ resource_group_name = local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. name
217+ location = lookup (each. value , " region" , null ) == null ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. location : local. global_settings . regions [each . value . region ]
218218 settings = each. value
219219 tags = try (each. value . tags , null )
220- base_tags = try (local. global_settings . inherit_tags , false ) ? local. resource_groups [each . value . resource_group_key ]. tags : {}
220+ base_tags = try (local. global_settings . inherit_tags , false ) ? local. combined_objects_resource_groups [ try (each . value . lz_key , local . client_config . landingzone_key )] [each . value . resource_group_key ]. tags : {}
221221 global_settings = local. global_settings
222222}
0 commit comments