azure Terraform -功能创建Swift虚拟网络不允许用于免费试用订阅-现收现付订阅

dwthyt8l  于 2023-01-05  发布在  Swift
关注(0)|答案(1)|浏览(154)

我试图使用azurerm_app_service_virtual_network_swift_connectionazurerm_linux_function_app,但得到这个错误,即使我是在支付,你去潜艇。

│ Error: creating/updating App Service VNet association between "rd-func8-func" (Resource Group "rg-rd-func8") and Virtual Network "rdfunc8-vnet": web.AppsClient#CreateOrUpdateSwiftVirtualNetworkConnectionWithCheck: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Feature Create Swift Virtual Network is not allowed for a free trial subscription." Details=[{"Message":"Feature Create Swift Virtual Network is not allowed for a free trial subscription."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"52018","Message":"Feature Create Swift Virtual Network is not allowed for a free trial subscription.","MessageTemplate":"Feature {0} is not allowed for a free trial subscription.","Parameters":["Create Swift Virtual Network"]}}]
│ 
│   with module.function.azurerm_app_service_virtual_network_swift_connection.example,
│   on modules/function/function.tf line 28, in resource "azurerm_app_service_virtual_network_swift_connection" "example":
│   28: resource "azurerm_app_service_virtual_network_swift_connection" "example" {

TF看起来像这样

resource "azurerm_linux_function_app" "this" {
  name                      = lower(format("%s-%s-func", var.client_name, var.project_name))
  resource_group_name       = var.resource_group_name
  location                  = var.resource_group_location

  storage_account_name = var.storage_account_name
  storage_account_access_key = var.storage_account_access_key

  service_plan_id = var.service_plan_id

  app_settings = {
    FUNCTIONS_WORKER_RUNTIME = "node"
  }

  site_config {
    application_stack {
      node_version = 18
    }
  }
}

resource "azurerm_app_service_virtual_network_swift_connection" "example" {
  app_service_id = azurerm_linux_function_app.this.id
  subnet_id      = var.virtual_network_subnet_id
}

Azure门户订阅

l7wslrjt

l7wslrjt1#

    • 我尝试在我的环境中使用terraform创建Swift Virtual Network with Pay-as-You-Go订阅,但出现相同错误:**

我在现收现付订阅帐户上的以下应用程序服务计划SKU中也遇到了同样的错误。

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Linux"
  sku_name            = "Y1"
}

要解决此错误,请选择列出的应用程序服务计划。

对于测试,我选择了Premium v2 P1V2计划。

    • 地形代码:**
provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "thejalinuxstorage1"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_virtual_network" "example" {
  name                = "example-virtual-network"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
  name                 = "example-subnet"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.1.0/24"]

  delegation {
    name = "example-delegation"

    service_delegation {
      name    = "Microsoft.Web/serverFarms"
      actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
    }
  }
}

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Linux"
  sku_name            = "P1v2"
}

resource "azurerm_linux_function_app" "venkat" {
  name                = "venkat-linux-function-app"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  service_plan_id            = azurerm_service_plan.example.id

  site_config {}
}

resource "azurerm_app_service_virtual_network_swift_connection" "thejaswiftconnection" {
  app_service_id = azurerm_linux_function_app.venkat.id
  subnet_id      = azurerm_subnet.example.id
}
    • 地形应用:**

运行代码后成功创建资源。

参考:azurerm_app_service_virtual_network_swift_connection

相关问题