Warning
This module has been ported to Azure Verified Modules and will be archived in the near future. https://registry.terraform.io/modules/Azure/avm-utl-regions/azurerm
This module provides an output of all Azure regions and availability zones.
The module outputs a list of objects with the following attributes:
name
- The name of the region. E.g. "eastus"display_name
- The display name of the region. E.g. "East US".paired_region_name
- The name of the region paired with this region. May benull
if the region has no pair.geography
- The geography of the region.geography_group
- The geography group of the region.zones
- A list of the availability zones in the region. Will benull
if the region does not support zones.
This data is the further composed into useful maps keyed by region name and region display name.
module "regions" {
source = "Azure/regions/azurerm"
version = "<version>" # change this to your desired version, https://www.terraform.io/language/expressions/version-constraints
}
output "regions" {
value = module.regions.regions
}
Belatedly adding this, waaaay overdue...
This module was created after a cool chat with @markti whilst we were at Hashiconf 2023. Thanks Mark!
The following requirements are needed by this module:
-
terraform (~> 1.6)
-
terraform (~> 1.6)
-
azapi (>= 1.9.0)
-
azapi (~> 1.13, != 1.13.0)
-
azurerm (>= 3.74.0)
-
azurerm (~> 3.74)
-
local (>= 2.4.0)
-
local (~> 2.4)
The following providers are used by this module:
The following resources are used by this module:
- azapi_resource_action.compute_provider (data source)
- azapi_resource_action.locations (data source)
- azurerm_client_config.current (data source)
No required inputs.
The following input variables are optional (have default values):
Description: If true, the module will only return regions that are have the category set to Recommended
by the locations API.
Type: bool
Default: true
Description: If true, the module will use cached data from the data directory. If false, the module will use live data from the Azure API.
The default is true to avoid unnecessary API calls and provide a guaranteed consistent output.
Set to false to ensure the latest data is used.
Using data from the Azure APIs means that if the API response changes, then the module output will change.
This may affect deployed resources that rely on this data.
Type: bool
Default: true
The following outputs are exported:
Description: A list of region objects. Each region object contains the following attributes:
name
- The name of the region.display_name
- The display name of the region.paired_region_name
- The name of the region paired with this region. May benull
if the region has no pair.geography
- The geography of the region.geography_group
- The geography group of the region.zones
- A list of the availability zones in the region. Will be empty if the region does not support zones.
Description: A map of region display names to region objects. See regions
output for more details.
Description: A map of geographies to a list of region objects. See regions
output for more details.
Description: A map of geography groups to a list of region objects. See regions
output for more details.
Description: A map of region display names to region objects. See regions
output for more details.
Description: A map of regions by either display names or name, to region objects. See regions
output for more details.
No modules.