diff --git a/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 b/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 index af8a81b..d7ee105 100644 --- a/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 +++ b/src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1 @@ -9,26 +9,23 @@ 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 + } } }