Skip to content

Commit

Permalink
Add Italy North and avoid casing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredfholgate committed Oct 6, 2023
1 parent 7d46177 commit 2baa81a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions examples/400-multi-with-orchestration/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ variable "root_name" {
variable "primary_location" {
type = string
description = "Sets the location for \"primary\" resources to be created in."
default = "northeurope"
default = "NorthEurope"
}

variable "secondary_location" {
type = string
description = "Sets the location for \"secondary\" resources to be created in."
default = "westeurope"
default = "WestEurope"
}

variable "subscription_id_connectivity" {
Expand Down
2 changes: 1 addition & 1 deletion locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ locals {
module.identity_resources.configuration.template_file_variables,
module.management_resources.configuration.template_file_variables,
)
default_location = var.default_location
default_location = lower(var.default_location)
default_tags = var.default_tags
disable_base_module_tags = var.disable_base_module_tags
disable_telemetry = var.disable_telemetry
Expand Down
2 changes: 2 additions & 0 deletions modules/connectivity/locals.geo_codes.tf.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"South India": "ins",
"westindia": "inw",
"West India": "inw",
"italynorth": "itn",
"Italy North": "itn",
"japaneast": "jpe",
"Japan East": "jpe",
"japanwest": "jpw",
Expand Down
28 changes: 16 additions & 12 deletions modules/connectivity/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ locals {
root_id = var.root_id
subscription_id = coalesce(var.subscription_id, "00000000-0000-0000-0000-000000000000")
settings = var.settings
location = var.location
location = lower(var.location)
tags = var.tags
resource_prefix = coalesce(var.resource_prefix, local.root_id)
resource_suffix = var.resource_suffix != local.empty_string ? "-${var.resource_suffix}" : local.empty_string
Expand All @@ -37,7 +37,7 @@ locals {
# terraform will throw an error at this point.
hub_networks_by_location = {
for hub_network in local.hub_networks :
coalesce(hub_network.config.location, local.location) => hub_network
coalesce(lower(hub_network.config.location), local.location) => hub_network
}
hub_network_locations = keys(local.hub_networks_by_location)
virtual_hubs = local.settings.vwan_hub_networks
Expand All @@ -54,29 +54,29 @@ locals {
# Groups per location if preferred.
virtual_hubs_by_location = {
for virtual_hub in local.virtual_hubs :
coalesce(virtual_hub.config.location, local.location) => virtual_hub
coalesce(lower(virtual_hub.config.location), local.location) => virtual_hub
}
virtual_hubs_by_location_for_resource_group_per_location = {
for virtual_hub in local.virtual_hubs :
coalesce(virtual_hub.config.location, local.location) => virtual_hub
coalesce(lower(virtual_hub.config.location), local.location) => virtual_hub
if local.resource_group_per_virtual_hub_location
}
virtual_hubs_by_location_for_shared_resource_group = {
for virtual_hub in local.virtual_hubs :
coalesce(virtual_hub.config.location, local.location) => virtual_hub
coalesce(lower(virtual_hub.config.location), local.location) => virtual_hub
if !local.resource_group_per_virtual_hub_location
}
# The following objects are used to identify azurerm_virtual_hub
# resources which need to be associated with a new or existing
# azurerm_virtual_wan resource
virtual_hubs_by_location_for_managed_virtual_wan = {
for virtual_hub in local.virtual_hubs :
coalesce(virtual_hub.config.location, local.location) => virtual_hub
coalesce(lower(virtual_hub.config.location), local.location) => virtual_hub
if local.existing_virtual_wan_resource_id == local.empty_string
}
virtual_hubs_by_location_for_existing_virtual_wan = {
for virtual_hub in local.virtual_hubs :
coalesce(virtual_hub.config.location, local.location) => virtual_hub
coalesce(lower(virtual_hub.config.location), local.location) => virtual_hub
if local.existing_virtual_wan_resource_id != local.empty_string
}
# Need to know the full list of virtual_hub_locations
Expand All @@ -89,9 +89,9 @@ locals {
length(local.virtual_hubs_by_location_for_managed_virtual_wan) > 0,
length(local.virtual_hubs_by_location_for_shared_resource_group) > 0,
]
) ? [local.location, ] : local.empty_list
ddos_location = coalesce(local.settings.ddos_protection_plan.config.location, local.location)
dns_location = coalesce(local.settings.dns.config.location, local.location)
) ? [local.location] : local.empty_list
ddos_location = coalesce(lower(local.settings.ddos_protection_plan.config.location), local.location)
dns_location = coalesce(lower(local.settings.dns.config.location), local.location)
connectivity_locations = distinct(concat(
local.hub_network_locations,
keys(local.virtual_hubs_by_location_for_resource_group_per_location),
Expand Down Expand Up @@ -1423,10 +1423,14 @@ locals {
# - azurerm_private_dns_zone
locals {
enable_private_link_by_service = local.settings.dns.config.enable_private_link_by_service
private_link_locations = coalescelist(local.settings.dns.config.private_link_locations, [local.location])
lowered_private_link_locations = [ for location in local.settings.dns.config.private_link_locations : lower(location) ]
private_link_locations = coalescelist(local.lowered_private_link_locations, [local.location])
private_dns_zone_prefix = "${local.resource_group_config_by_scope_and_location["dns"][local.dns_location].resource_id}/providers/Microsoft.Network/privateDnsZones/"

lowered_builtin_azure_backup_geo_codes = { for key, value in local.builtin_azure_backup_geo_codes : lower(key) => lower(value) }

lookup_azure_backup_geo_codes = merge(
local.builtin_azure_backup_geo_codes,
local.lowered_builtin_azure_backup_geo_codes,
local.custom_azure_backup_geo_codes,
)
lookup_private_link_dns_zone_by_service = {
Expand Down
2 changes: 1 addition & 1 deletion modules/management/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ locals {
root_id = var.root_id
subscription_id = coalesce(var.subscription_id, "00000000-0000-0000-0000-000000000000")
settings = var.settings
location = var.location
location = lower(var.location)
tags = var.tags
resource_prefix = coalesce(var.resource_prefix, local.root_id)
resource_suffix = length(var.resource_suffix) > 0 ? "-${var.resource_suffix}" : local.empty_string
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/test_001_baseline/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "root_name" {
variable "primary_location" {
type = string
description = "Sets the location for \"primary\" resources to be created in."
default = "northeurope"
default = "NorthEurope"
}

variable "secondary_location" {
Expand Down

0 comments on commit 2baa81a

Please sign in to comment.