From f2159b2b18fde75663c3e8ce37000f8c25d0c3d2 Mon Sep 17 00:00:00 2001 From: Jared Holgate Date: Wed, 11 Dec 2024 10:44:39 +0000 Subject: [PATCH] fix: regions provider version (#263) # Pull Request ## Issue #213 ## Description Fix the regions provider version and use the AVM e2e test run for this branch: https://github.com/Azure/accelerator-bootstrap-modules/actions/runs/12273987111 ## License By submitting this pull request, I confirm that my contribution is made under the terms of the projects associated license. --- .../Config-Helpers/Get-AzureRegionData.ps1 | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 b/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 index af8a81bf..219c232a 100644 --- a/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 +++ b/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 @@ -9,26 +9,24 @@ terraform { required_providers { azapi = { source = "azure/azapi" - version = "~> 1.14" + version = "~> 2.0" } } } -data "azapi_client_config" "current" {} - -data "azapi_resource_action" "locations" { - type = "Microsoft.Resources/subscriptions@2022-12-01" - action = "locations" - method = "GET" - resource_id = "/subscriptions/${data.azapi_client_config.current.subscription_id}" - response_export_values = ["value"] +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 jsondecode(data.azapi_resource_action.locations.output).value : region.name => { - display_name = region.displayName - zones = try([ for zone in region.availabilityZoneMappings : zone.logicalZone ], []) - } if region.metadata.regionType == "Physical" + regions = { for region in module.regions.regions_by_name : region.name => { + display_name = region.display_name + zones = region.zones == null ? [] : region.zones + } } }