Skip to content

Commit

Permalink
line endings
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Nov 26, 2024
1 parent c11cdf6 commit 92bd4e9
Show file tree
Hide file tree
Showing 10 changed files with 651 additions and 651 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

102 changes: 51 additions & 51 deletions templates/complete_multi_region/locals-config.tf
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
locals {
config_template_file_variables = {
starter_location_01 = var.starter_locations[0]
starter_location_02 = try(var.starter_locations[1], null)
starter_location_03 = try(var.starter_locations[2], null)
starter_location_04 = try(var.starter_locations[3], null)
starter_location_05 = try(var.starter_locations[4], null)
starter_location_06 = try(var.starter_locations[5], null)
starter_location_07 = try(var.starter_locations[6], null)
starter_location_08 = try(var.starter_locations[7], null)
starter_location_09 = try(var.starter_locations[8], null)
starter_location_10 = try(var.starter_locations[9], null)
starter_location_01_availability_zones = jsonencode(local.regions[var.starter_locations[0]].zones)
starter_location_02_availability_zones = jsonencode(try(local.regions[var.starter_locations[1]].zones, null))
starter_location_03_availability_zones = jsonencode(try(local.regions[var.starter_locations[2]].zones, null))
starter_location_04_availability_zones = jsonencode(try(local.regions[var.starter_locations[3]].zones, null))
starter_location_05_availability_zones = jsonencode(try(local.regions[var.starter_locations[4]].zones, null))
starter_location_06_availability_zones = jsonencode(try(local.regions[var.starter_locations[5]].zones, null))
starter_location_07_availability_zones = jsonencode(try(local.regions[var.starter_locations[6]].zones, null))
starter_location_08_availability_zones = jsonencode(try(local.regions[var.starter_locations[7]].zones, null))
starter_location_09_availability_zones = jsonencode(try(local.regions[var.starter_locations[8]].zones, null))
starter_location_10_availability_zones = jsonencode(try(local.regions[var.starter_locations[9]].zones, null))
starter_location_01_virtual_network_gateway_sku_express_route = local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[0]].express_route
starter_location_02_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[1]].express_route, null)
starter_location_03_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[2]].express_route, null)
starter_location_04_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[3]].express_route, null)
starter_location_05_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[4]].express_route, null)
starter_location_06_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[5]].express_route, null)
starter_location_07_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[6]].express_route, null)
starter_location_08_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[7]].express_route, null)
starter_location_09_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[8]].express_route, null)
starter_location_10_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[9]].express_route, null)
starter_location_01_virtual_network_gateway_sku_vpn = local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[0]].vpn
starter_location_02_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[1]].vpn, null)
starter_location_03_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[2]].vpn, null)
starter_location_04_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[3]].vpn, null)
starter_location_05_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[4]].vpn, null)
starter_location_06_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[5]].vpn, null)
starter_location_07_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[6]].vpn, null)
starter_location_08_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[7]].vpn, null)
starter_location_09_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[8]].vpn, null)
starter_location_10_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[9]].vpn, null)
root_parent_management_group_id = var.root_parent_management_group_id == "" ? data.azurerm_client_config.current.tenant_id : var.root_parent_management_group_id
subscription_id_connectivity = var.subscription_id_connectivity
subscription_id_identity = var.subscription_id_identity
subscription_id_management = var.subscription_id_management
}

resource_group_names = { for key, value in module.resource_groups : "connectivity_resource_group_${key}" => value.name }
final_replacements = merge(local.config_template_file_variables, local.resource_group_names)
}
locals {
config_template_file_variables = {
starter_location_01 = var.starter_locations[0]
starter_location_02 = try(var.starter_locations[1], null)
starter_location_03 = try(var.starter_locations[2], null)
starter_location_04 = try(var.starter_locations[3], null)
starter_location_05 = try(var.starter_locations[4], null)
starter_location_06 = try(var.starter_locations[5], null)
starter_location_07 = try(var.starter_locations[6], null)
starter_location_08 = try(var.starter_locations[7], null)
starter_location_09 = try(var.starter_locations[8], null)
starter_location_10 = try(var.starter_locations[9], null)
starter_location_01_availability_zones = jsonencode(local.regions[var.starter_locations[0]].zones)
starter_location_02_availability_zones = jsonencode(try(local.regions[var.starter_locations[1]].zones, null))
starter_location_03_availability_zones = jsonencode(try(local.regions[var.starter_locations[2]].zones, null))
starter_location_04_availability_zones = jsonencode(try(local.regions[var.starter_locations[3]].zones, null))
starter_location_05_availability_zones = jsonencode(try(local.regions[var.starter_locations[4]].zones, null))
starter_location_06_availability_zones = jsonencode(try(local.regions[var.starter_locations[5]].zones, null))
starter_location_07_availability_zones = jsonencode(try(local.regions[var.starter_locations[6]].zones, null))
starter_location_08_availability_zones = jsonencode(try(local.regions[var.starter_locations[7]].zones, null))
starter_location_09_availability_zones = jsonencode(try(local.regions[var.starter_locations[8]].zones, null))
starter_location_10_availability_zones = jsonencode(try(local.regions[var.starter_locations[9]].zones, null))
starter_location_01_virtual_network_gateway_sku_express_route = local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[0]].express_route
starter_location_02_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[1]].express_route, null)
starter_location_03_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[2]].express_route, null)
starter_location_04_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[3]].express_route, null)
starter_location_05_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[4]].express_route, null)
starter_location_06_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[5]].express_route, null)
starter_location_07_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[6]].express_route, null)
starter_location_08_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[7]].express_route, null)
starter_location_09_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[8]].express_route, null)
starter_location_10_virtual_network_gateway_sku_express_route = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[9]].express_route, null)
starter_location_01_virtual_network_gateway_sku_vpn = local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[0]].vpn
starter_location_02_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[1]].vpn, null)
starter_location_03_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[2]].vpn, null)
starter_location_04_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[3]].vpn, null)
starter_location_05_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[4]].vpn, null)
starter_location_06_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[5]].vpn, null)
starter_location_07_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[6]].vpn, null)
starter_location_08_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[7]].vpn, null)
starter_location_09_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[8]].vpn, null)
starter_location_10_virtual_network_gateway_sku_vpn = try(local.hub_and_spoke_vnet_gateway_default_skus[var.starter_locations[9]].vpn, null)
root_parent_management_group_id = var.root_parent_management_group_id == "" ? data.azurerm_client_config.current.tenant_id : var.root_parent_management_group_id
subscription_id_connectivity = var.subscription_id_connectivity
subscription_id_identity = var.subscription_id_identity
subscription_id_management = var.subscription_id_management
}

resource_group_names = { for key, value in module.resource_groups : "connectivity_resource_group_${key}" => value.name }
final_replacements = merge(local.config_template_file_variables, local.resource_group_names)
}
44 changes: 22 additions & 22 deletions templates/complete_multi_region/locals-hub-and-spoke-vnet.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
locals {
hub_and_spoke_vnet_gateway_default_skus = { for key, value in local.regions : key => length(value.zones) == 0 ? {
express_route = "Standard"
vpn = "VpnGw1"
} : {
express_route = "ErGw1AZ"
vpn = "VpnGw1AZ"
}
}
}

locals {
hub_and_spoke_vnet_settings_json = tostring(jsonencode(var.hub_and_spoke_vnet_settings))
hub_and_spoke_vnet_settings_json_templated = templatestring(local.hub_and_spoke_vnet_settings_json, local.final_replacements)
hub_and_spoke_vnet_settings_json_final = replace(replace(local.hub_and_spoke_vnet_settings_json_templated, "\"[", "["), "]\"", "]")
hub_and_spoke_vnet_settings = jsondecode(local.hub_and_spoke_vnet_settings_json_final)

hub_and_spoke_vnet_virtual_networks_json = tostring(jsonencode(var.hub_and_spoke_vnet_virtual_networks))
hub_and_spoke_vnet_virtual_networks_json_templated = templatestring(local.hub_and_spoke_vnet_virtual_networks_json, local.final_replacements)
hub_and_spoke_vnet_virtual_networks_json_final = replace(replace(local.hub_and_spoke_vnet_virtual_networks_json_templated, "\"[", "["), "]\"", "]")
hub_and_spoke_vnet_virtual_networks = local.connectivity_hub_and_spoke_vnet_enabled ? jsondecode(local.hub_and_spoke_vnet_virtual_networks_json_final) : {}
}
locals {
hub_and_spoke_vnet_gateway_default_skus = { for key, value in local.regions : key => length(value.zones) == 0 ? {
express_route = "Standard"
vpn = "VpnGw1"
} : {
express_route = "ErGw1AZ"
vpn = "VpnGw1AZ"
}
}
}

locals {
hub_and_spoke_vnet_settings_json = tostring(jsonencode(var.hub_and_spoke_vnet_settings))
hub_and_spoke_vnet_settings_json_templated = templatestring(local.hub_and_spoke_vnet_settings_json, local.final_replacements)
hub_and_spoke_vnet_settings_json_final = replace(replace(local.hub_and_spoke_vnet_settings_json_templated, "\"[", "["), "]\"", "]")
hub_and_spoke_vnet_settings = jsondecode(local.hub_and_spoke_vnet_settings_json_final)

hub_and_spoke_vnet_virtual_networks_json = tostring(jsonencode(var.hub_and_spoke_vnet_virtual_networks))
hub_and_spoke_vnet_virtual_networks_json_templated = templatestring(local.hub_and_spoke_vnet_virtual_networks_json, local.final_replacements)
hub_and_spoke_vnet_virtual_networks_json_final = replace(replace(local.hub_and_spoke_vnet_virtual_networks_json_templated, "\"[", "["), "]\"", "]")
hub_and_spoke_vnet_virtual_networks = local.connectivity_hub_and_spoke_vnet_enabled ? jsondecode(local.hub_and_spoke_vnet_virtual_networks_json_final) : {}
}
26 changes: 13 additions & 13 deletions templates/complete_multi_region/locals-management.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
locals {
management_settings_es_json = tostring(jsonencode(var.management_settings_es))
management_settings_es_json_templated = templatestring(local.management_settings_es_json, local.final_replacements)
management_settings_es_json_final = replace(replace(local.management_settings_es_json_templated, "\"[", "["), "]\"", "]")
management_settings_es = jsondecode(local.management_settings_es_json_final)
}

locals {
management_settings_avm_json = tostring(jsonencode(var.management_settings_avm))
management_settings_avm_json_templated = templatestring(local.management_settings_avm_json, local.final_replacements)
management_settings_avm_json_final = replace(replace(local.management_settings_avm_json_templated, "\"[", "["), "]\"", "]")
management_settings_avm = jsondecode(local.management_settings_avm_json_final)
}
locals {
management_settings_es_json = tostring(jsonencode(var.management_settings_es))
management_settings_es_json_templated = templatestring(local.management_settings_es_json, local.final_replacements)
management_settings_es_json_final = replace(replace(local.management_settings_es_json_templated, "\"[", "["), "]\"", "]")
management_settings_es = jsondecode(local.management_settings_es_json_final)
}

locals {
management_settings_avm_json = tostring(jsonencode(var.management_settings_avm))
management_settings_avm_json_templated = templatestring(local.management_settings_avm_json, local.final_replacements)
management_settings_avm_json_final = replace(replace(local.management_settings_avm_json_templated, "\"[", "["), "]\"", "]")
management_settings_avm = jsondecode(local.management_settings_avm_json_final)
}
22 changes: 11 additions & 11 deletions templates/complete_multi_region/locals-virtual-wan.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
locals {
virtual_wan_settings_json = tostring(jsonencode(var.virtual_wan_settings))
virtual_wan_settings_json_templated = templatestring(local.virtual_wan_settings_json, local.final_replacements)
virtual_wan_settings_json_final = replace(replace(local.virtual_wan_settings_json_templated, "\"[", "["), "]\"", "]")
virtual_wan_settings = local.connectivity_virtual_wan_enabled ? jsondecode(local.virtual_wan_settings_json_final) : null

virtual_wan_virtual_hubs_json = tostring(jsonencode(var.virtual_wan_virtual_hubs))
virtual_wan_virtual_hubs_json_templated = templatestring(local.virtual_wan_virtual_hubs_json, local.final_replacements)
virtual_wan_virtual_hubs_json_final = replace(replace(local.virtual_wan_virtual_hubs_json_templated, "\"[", "["), "]\"", "]")
virtual_wan_virtual_hubs = local.connectivity_virtual_wan_enabled ? jsondecode(local.virtual_wan_virtual_hubs_json_final) : {}
}
locals {
virtual_wan_settings_json = tostring(jsonencode(var.virtual_wan_settings))
virtual_wan_settings_json_templated = templatestring(local.virtual_wan_settings_json, local.final_replacements)
virtual_wan_settings_json_final = replace(replace(local.virtual_wan_settings_json_templated, "\"[", "["), "]\"", "]")
virtual_wan_settings = local.connectivity_virtual_wan_enabled ? jsondecode(local.virtual_wan_settings_json_final) : null

virtual_wan_virtual_hubs_json = tostring(jsonencode(var.virtual_wan_virtual_hubs))
virtual_wan_virtual_hubs_json_templated = templatestring(local.virtual_wan_virtual_hubs_json, local.final_replacements)
virtual_wan_virtual_hubs_json_final = replace(replace(local.virtual_wan_virtual_hubs_json_templated, "\"[", "["), "]\"", "]")
virtual_wan_virtual_hubs = local.connectivity_virtual_wan_enabled ? jsondecode(local.virtual_wan_virtual_hubs_json_final) : {}
}
28 changes: 14 additions & 14 deletions templates/complete_multi_region/networking-hub-and-spoke-vnet.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module "hub_and_spoke_vnet" {
source = "./modules/hub-and-spoke-vnet"

count = !var.skip_deploy && local.connectivity_hub_and_spoke_vnet_enabled ? 1 : 0

hub_and_spoke_networks_settings = local.hub_and_spoke_vnet_settings
hub_virtual_networks = local.hub_and_spoke_vnet_virtual_networks
enable_telemetry = var.enable_telemetry
tags = var.tags

providers = {
azurerm = azurerm.connectivity
}
}
module "hub_and_spoke_vnet" {
source = "./modules/hub-and-spoke-vnet"

count = !var.skip_deploy && local.connectivity_hub_and_spoke_vnet_enabled ? 1 : 0

hub_and_spoke_networks_settings = local.hub_and_spoke_vnet_settings
hub_virtual_networks = local.hub_and_spoke_vnet_virtual_networks
enable_telemetry = var.enable_telemetry
tags = var.tags

providers = {
azurerm = azurerm.connectivity
}
}
Loading

0 comments on commit 92bd4e9

Please sign in to comment.