【问题标题】:Terraform --> Azure App Service Plan: Requested features are not supported in regionTerraform --> Azure 应用服务计划:区域不支持请求的功能
【发布时间】:2020-01-01 14:43:03
【问题描述】:

我正在尝试使用 Terraform 来部署具有高级消费计划的 Azure Functions 应用程序。除其他资源外,还有 terraform docs 所需的应用服务计划。

在尝试创建 svc 计划时,出现以下错误。

错误:创建/更新应用服务计划“task-scheduler-svc-plan”(资源组“tasks”)时出错:web.AppServicePlansClient#CreateOrUpdate:发送请求失败:StatusCode=400 -- 原始错误:Code=" BadRequest" Message="区域不支持请求的功能。" Details=[{"Message":"区域不支持请求的功能。"},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"59911 ","Message":"区域不支持请求的功能。","MessageTemplate":"区域不支持请求的功能。","Parameters":[]}}]

我所有的资源都有westeurope 区域。不幸的是,该错误并没有说明是什么功能导致了这种情况..

请在下面找到我的 tf 模板。有人发现错误吗?

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"
    }
}

【问题讨论】:

    标签: azure-functions terraform azure-app-service-plans terraform-provider-azure


    【解决方案1】:

    我假设您使用的变量app-svc-plan-name 的值为task-scheduler。所以我猜azurerm_app_service_plan 是你错误的原因。也许改变一些参数?在他们用于 is_xenon PremiumContainer 层的 terraform 示例中。也许这就是问题所在,因为您使用的是 ElasticPremiumTerraform : azurerm_app_service_plan.

    【讨论】:

    • 取消注释 is_xenon 确实是解决方案。感谢您发现它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多