diff --git a/.github/workflows/end-to-end-test.yml b/.github/workflows/end-to-end-test.yml index cb70301..d019166 100644 --- a/.github/workflows/end-to-end-test.yml +++ b/.github/workflows/end-to-end-test.yml @@ -140,7 +140,8 @@ jobs: "westeurope", "westus2", "westus3", - "australiaeast" + "australiaeast", + "swedencentral" ) $locationsSingleAvailabilityZone = @( @@ -215,6 +216,9 @@ jobs: $Inputs["use_separate_repository_for_templates"] = "true" $Inputs["use_self_hosted_runners"] = $enableSelfHostedAgents $Inputs["use_runner_group"] = "true" + if($location -eq "swedencentral") { + $Inputs["runner_container_zone_support"] = "false" + } } if($versionControlSystem -eq "azuredevops") { @@ -226,6 +230,9 @@ jobs: $Inputs["azure_devops_create_project"] = "true" $Inputs["azure_devops_project_name"] = "alz-test-$uniqueId" $Inputs["use_self_hosted_agents"] = $enableSelfHostedAgents + if($location -eq "swedencentral") { + $Inputs["agent_container_zone_support"] = "false" + } } if($versionControlSystem -eq "local") { @@ -238,6 +245,7 @@ jobs: $Inputs["subscription_id_connectivity"] = "${{ vars.ARM_SUBSCRIPTION_ID }}" $Inputs["subscription_id_identity"] = "${{ vars.ARM_SUBSCRIPTION_ID }}" $Inputs["subscription_id_management"] = "${{ vars.ARM_SUBSCRIPTION_ID }}" + $Inputs["parent_management_group_display_name"] = "Tenant Root Group" $Inputs["child_management_group_display_name"] = "E2E Test" $Inputs["resource_group_location"] = $location diff --git a/alz/azuredevops/locals.tf b/alz/azuredevops/locals.tf index 72b0404..5c28db0 100644 --- a/alz/azuredevops/locals.tf +++ b/alz/azuredevops/locals.tf @@ -61,7 +61,7 @@ locals { memory = var.agent_container_memory cpu_max = var.agent_container_cpu_max memory_max = var.agent_container_memory_max - zones = ["1"] + zones = var.agent_container_zone_support ? ["1"] : [] } agent_02 = { container_instance_name = local.resource_names.container_instance_02 @@ -70,7 +70,7 @@ locals { memory = var.agent_container_memory cpu_max = var.agent_container_cpu_max memory_max = var.agent_container_memory_max - zones = ["2"] + zones = var.agent_container_zone_support ? ["2"] : [] } } : {} } diff --git a/alz/azuredevops/terraform.tf b/alz/azuredevops/terraform.tf index ca46412..dd12ba8 100644 --- a/alz/azuredevops/terraform.tf +++ b/alz/azuredevops/terraform.tf @@ -7,7 +7,7 @@ terraform { } azapi = { source = "azure/azapi" - version = "~> 1.13" + version = "~> 2.0" } azuredevops = { source = "microsoft/azuredevops" diff --git a/alz/azuredevops/variables.hidden.tf b/alz/azuredevops/variables.hidden.tf index 6634127..e462a8b 100644 --- a/alz/azuredevops/variables.hidden.tf +++ b/alz/azuredevops/variables.hidden.tf @@ -58,6 +58,12 @@ variable "agent_container_memory_max" { default = 4 } +variable "agent_container_zone_support" { + description = "The container zone support" + type = bool + default = true +} + variable "built_in_configurartion_file_names" { description = "Built-in configuration file name" type = list(string) diff --git a/alz/github/locals.tf b/alz/github/locals.tf index d4716e4..9f3af12 100644 --- a/alz/github/locals.tf +++ b/alz/github/locals.tf @@ -69,7 +69,7 @@ locals { memory = var.runner_container_memory cpu_max = var.runner_container_cpu_max memory_max = var.runner_container_memory_max - zones = ["1"] + zones = var.runner_container_zone_support ? ["1"] : [] } agent_02 = { container_instance_name = local.resource_names.container_instance_02 @@ -78,7 +78,7 @@ locals { memory = var.runner_container_memory cpu_max = var.runner_container_cpu_max memory_max = var.runner_container_memory_max - zones = ["2"] + zones = var.runner_container_zone_support ? ["2"] : [] } } : {} } diff --git a/alz/github/terraform.tf b/alz/github/terraform.tf index e2c7386..231a8f7 100644 --- a/alz/github/terraform.tf +++ b/alz/github/terraform.tf @@ -7,7 +7,7 @@ terraform { } azapi = { source = "azure/azapi" - version = "~> 1.13" + version = "~> 2.0" } github = { source = "integrations/github" diff --git a/alz/github/variables.hidden.tf b/alz/github/variables.hidden.tf index 28cf2c0..d18f5f4 100644 --- a/alz/github/variables.hidden.tf +++ b/alz/github/variables.hidden.tf @@ -94,6 +94,12 @@ variable "runner_container_memory_max" { default = 4 } +variable "runner_container_zone_support" { + description = "The container zone support" + type = bool + default = true +} + variable "runner_name_environment_variable" { description = "The runner name environment variable supplied to the container" type = string diff --git a/alz/local/terraform.tf b/alz/local/terraform.tf index 84858e1..1af26d8 100644 --- a/alz/local/terraform.tf +++ b/alz/local/terraform.tf @@ -7,7 +7,7 @@ terraform { } azapi = { source = "azure/azapi" - version = "~> 1.13" + version = "~> 2.0" } local = { source = "hashicorp/local" diff --git a/modules/azure/container_instances.tf b/modules/azure/container_instances.tf index 30314ec..0c2b073 100644 --- a/modules/azure/container_instances.tf +++ b/modules/azure/container_instances.tf @@ -6,7 +6,7 @@ resource "azurerm_container_group" "alz" { ip_address_type = var.use_private_networking ? "Private" : "None" os_type = "Linux" subnet_ids = var.use_private_networking ? [azurerm_subnet.container_instances[0].id] : [] - zones = each.value.zones + zones = length(local.bootstrap_location_zones) == 0 ? null : each.value.zones identity { type = "UserAssigned" diff --git a/modules/azure/data.tf b/modules/azure/data.tf index 6279fc7..7a54d2a 100644 --- a/modules/azure/data.tf +++ b/modules/azure/data.tf @@ -16,3 +16,20 @@ data "http" "ip" { min_delay_ms = 500 } } + +module "regions" { + source = "Azure/avm-utl-regions/azurerm" + version = "0.3.0" + use_cached_data = false + availability_zones_filter = false + recommended_filter = false +} + +locals { + regions = { for region in module.regions.regions_by_name : region.name => { + display_name = region.display_name + zones = region.zones == null ? [] : region.zones + } + } + bootstrap_location_zones = local.regions[var.azure_location].zones +} diff --git a/modules/azure/terraform.tf b/modules/azure/terraform.tf index 74507d1..5a894e1 100644 --- a/modules/azure/terraform.tf +++ b/modules/azure/terraform.tf @@ -6,7 +6,7 @@ terraform { } azapi = { source = "azure/azapi" - version = "~> 1.13" + version = "~> 2.0" } http = { source = "hashicorp/http"