1
votes

I am experimenting with Terraform to deploy an Azure functions app with the premium consumption plan. Among other resources there is the app service plan that is needed as per terraform docs.

When trying to crete the svc plan, I am greeted with the following error.

Error: Error creating/updating App Service Plan "task-scheduler-svc-plan" (Resource Group "tasks"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Requested features are not supported in region." Details=[{"Message":"Requested features are not supported in region."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"59911","Message":"Requested features are not supported in region.","MessageTemplate":"Requested features are not supported in region.","Parameters":[]}}]

All my resources have the westeurope region. Unfortunately the error does not give any indication as to what feature is causing this..

Please find my tf template below. Does anyone spot the error?

provider "azurerm" {
    version = "=1.33.1"
}

resource "azurerm_resource_group" "tasks" {
    name     = "tasks"
    location = "${var.location}"
    tags = "${var.tags}"
}

# AZURE FUNCTIONS
resource "azurerm_app_service_plan" "tasks" {
    name                = "${var.app-svc-plan-name}-svc-plan"
    location            = "${var.location}"
    resource_group_name = "${azurerm_resource_group.tasks.name}"
    kind                = "elastic"
    is_xenon            = true
    per_site_scaling = false
    maximum_elastic_worker_count = 5
    sku {
        tier = "ElasticPremium"
        size = "EP1"
        capacity = 1
    }
}
resource "azurerm_app_service" "tasks" {
    name                = "az-func-svc"
    location            = "${var.location}"
    resource_group_name = "${azurerm_resource_group.tasks.name}"
    app_service_plan_id = "${azurerm_app_service_plan.tasks.id}"
    https_only = true

    site_config {
        # allow inbound connections only FROM
            ip_restriction {
                ip_address = "${data.azurerm_key_vault_secret.external-ip-range.value}"
            }

            use_32_bit_worker_process = false

        # for access INTO vnet
        # requires a delegated subnet
        virtual_network_name = "${data.azurerm_virtual_network.vnet.name}"

    }
}
resource "azurerm_storage_account" "az-func-tasks" {
    name                     = "azfunctasks"
    resource_group_name      = "${azurerm_resource_group.tasks.name}"
    location                 = "${var.location}"
    account_tier             = "Standard"
    account_replication_type = "LRS"
}
resource "azurerm_application_insights" "az-func" {
    name                = "az-func-ai"
    location            = "${var.location}"
    resource_group_name = "${azurerm_resource_group.tasks.name}"
    application_type    = "Web"
}
resource "azurerm_function_app" "az-func-app" {
    name                      = "az-func-app"
    location                  = "${var.location}"
    resource_group_name       = "${azurerm_resource_group.tasks.name}"
    app_service_plan_id       = "${azurerm_app_service_plan.tasks.id}"
    storage_connection_string = "${azurerm_storage_account.az-func-tasks.primary_connection_string}"
    version = "~2"

    app_settings = {
        APPINSIGHTS_INSTRUMENTATIONKEY = "${azurerm_application_insights.az-func.instrumentation_key}"
        FUNCTIONS_WORKER_RUNTIME = "powershell"
    }
    
    identity {
        type = "SystemAssigned"
    }
}
1

1 Answers

1
votes

I would assume that you are using the variable app-svc-plan-name with the value task-scheduler. So I would guess that the azurerm_app_service_plan is the reason for your error. Perhaps change some parameter? In the terraform example they use for is_xenon the PremiumContainer tier. Perhaps this is the problem, because you use ElasticPremium. Terraform : azurerm_app_service_plan.