Search code examples
azureterraformazure-cligeoazure-traffic-manager

Azure Traffic Manager Endpoint: The following locations specified in the geoMapping property for endpoint are not supported


I'm trying to create an Azure Traffic Manager Endpoint via Terraform, but I don't know what to put in "geo_mappings" value. This is my resource:

resource "azurerm_traffic_manager_azure_endpoint" "se22condary-ae" {
  name                = "se22condary-endpoint"
  profile_id           = azurerm_traffic_manager_profile.tm.id
  target_resource_id  = azurerm_linux_web_app.secondary.id
  geo_mappings         = ["Europe"]
}

And I have this error:

Error: creating/updating Endpoint Type (Subscription: "xxx"
│ Resource Group Name: "ist-platform-geodev2"
│ Traffic Manager Profile Name: "ist-traffic-manager-geodev2"
│ Endpoint Type: "AzureEndpoints"
│ Endpoint Name: "s22econdary-endpoint"): endpoints.EndpointsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="The following locations specified in the geoMapping property for endpoint ‘s22econdary-endpoint’ are not supported: EUROPE. For a list of supported locations, see the Traffic Manager documentation."
│
│   with azurerm_traffic_manager_azure_endpoint.se22condary-ae,
│   on main-geodev2.tf line 475, in resource "azurerm_traffic_manager_azure_endpoint" "se22condary-ae":
│  475: resource "azurerm_traffic_manager_azure_endpoint" "se22condary-ae" {

It seems that the Azure documentation is not updated and I can't find values. I tryed with "Europe" "EU" "North Europe", but problem still


Solution

  • You can use the Geographic Hierarchies - Get Default endpoint or run the following Azure CLI command to get the list of country/region codes:

    az network traffic-manager endpoint show-geographic-hierarchy
    

    From the output we can see that the code for Europe region is GEO-EU:

    {
      "geographicHierarchy": {
        "code": "WORLD",
        "name": "World",
        "regions": [
          {
            "code": "GEO-EU",
            "name": "Europe",
            "regions": [
              {
                "code": "AD",
                "name": "Andorra",
                "regions": []
              }
    
         // rest of content here
    }