Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions src/ALZ/Private/Config-Helpers/Get-AzureRegionData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
Loading