通过 Terraform 为 Azure 应用服务(Web 应用)设置 VNet 集成
Setup VNet integration for an Azure App Service (web app) via Terraform
我正在尝试通过 Terraform 为 Azure 应用服务(Web 应用)设置 VNet 集成,下面是我一直在使用的代码:
resource "azurerm_subnet" "network_app_wtier_subnet" {
name = "App-Web-tier"
resource_group_name = azurerm_resource_group.network_rg.name
virtual_network_name = local.vnet_name
address_prefixes = ["10.1.1.0/27"]
delegation {
name = "delegation"
service_delegation {
actions = [
"Microsoft.Network/virtualNetworks/subnets/action",
"Microsoft.Network/virtualNetworks/subnets/join/action"
]
name = "Microsoft.Web/serverfarms"
}
}
}
...我收到以下错误:
> Error: expected delegation.0.service_delegation.0.name to be one of
> [Microsoft.ApiManagement/service
> Microsoft.AzureCosmosDB/clusters
> Microsoft.BareMetal/AzureVMware Microsoft.BareMetal/CrayServers
> Microsoft.Batch/batchAccounts
> Microsoft.ContainerInstance/containerGroups
> Microsoft.Databricks/workspaces Microsoft.DBforMySQL/flexibleServers
> Microsoft.DBforMySQL/serversv2
> Microsoft.DBforPostgreSQL/flexibleServers
> Microsoft.DBforPostgreSQL/serversv2
> Microsoft.DBforPostgreSQL/singleServers
> Microsoft.HardwareSecurityModules/dedicatedHSMs
> Microsoft.Kusto/clusters
> Microsoft.Logic/integrationServiceEnvironments
> Microsoft.MachineLearningServices/workspaces Microsoft.Netapp/volumes
> Microsoft.Network/managedResolvers
> Microsoft.PowerPlatform/vnetaccesslinks
> Microsoft.ServiceFabricMesh/networks Microsoft.Sql/managedInstances
> Microsoft.Sql/servers Microsoft.StreamAnalytics/streamingJobs
> Microsoft.Synapse/workspaces Microsoft.Web/hostingEnvironments
> Microsoft.Web/serverFarms], got Microsoft.Web/serverfarms
> │
> │ with module.paired_regions_network.azurerm_subnet.network_app_wtier_subnet,
> │ on modules/network/main.tf line 49, in resource "azurerm_subnet" "network_app_wtier_subnet":
> │ 49: name = "Microsoft.Web/serverfarms"
错误本身是矛盾的:所以,它期望 Microsoft.Web/serverFarms
,得到 Microsoft.Web/serverFarms
,但仍然有错误?
知道如何解决这个问题吗?
编辑
我最初编写 post 时使用的配置如下:
terraform {
backend "azurerm" { }
required_version = ">= 0.14"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.50.0"
}
}
}
我想这应该可以容纳任何更新。对吗?
将其更新到更新的版本(如下)导致了同样的错误。
terraform {
backend "azurerm" { }
required_version = ">= 0.15"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.72.0"
}
}
}
啊,我可以复制它 - 并修复它。它区分大小写...使用 "Microsoft.Web/serverFarms"
代替(大写 F)
我正在尝试通过 Terraform 为 Azure 应用服务(Web 应用)设置 VNet 集成,下面是我一直在使用的代码:
resource "azurerm_subnet" "network_app_wtier_subnet" {
name = "App-Web-tier"
resource_group_name = azurerm_resource_group.network_rg.name
virtual_network_name = local.vnet_name
address_prefixes = ["10.1.1.0/27"]
delegation {
name = "delegation"
service_delegation {
actions = [
"Microsoft.Network/virtualNetworks/subnets/action",
"Microsoft.Network/virtualNetworks/subnets/join/action"
]
name = "Microsoft.Web/serverfarms"
}
}
}
...我收到以下错误:
> Error: expected delegation.0.service_delegation.0.name to be one of
> [Microsoft.ApiManagement/service
> Microsoft.AzureCosmosDB/clusters
> Microsoft.BareMetal/AzureVMware Microsoft.BareMetal/CrayServers
> Microsoft.Batch/batchAccounts
> Microsoft.ContainerInstance/containerGroups
> Microsoft.Databricks/workspaces Microsoft.DBforMySQL/flexibleServers
> Microsoft.DBforMySQL/serversv2
> Microsoft.DBforPostgreSQL/flexibleServers
> Microsoft.DBforPostgreSQL/serversv2
> Microsoft.DBforPostgreSQL/singleServers
> Microsoft.HardwareSecurityModules/dedicatedHSMs
> Microsoft.Kusto/clusters
> Microsoft.Logic/integrationServiceEnvironments
> Microsoft.MachineLearningServices/workspaces Microsoft.Netapp/volumes
> Microsoft.Network/managedResolvers
> Microsoft.PowerPlatform/vnetaccesslinks
> Microsoft.ServiceFabricMesh/networks Microsoft.Sql/managedInstances
> Microsoft.Sql/servers Microsoft.StreamAnalytics/streamingJobs
> Microsoft.Synapse/workspaces Microsoft.Web/hostingEnvironments
> Microsoft.Web/serverFarms], got Microsoft.Web/serverfarms
> │
> │ with module.paired_regions_network.azurerm_subnet.network_app_wtier_subnet,
> │ on modules/network/main.tf line 49, in resource "azurerm_subnet" "network_app_wtier_subnet":
> │ 49: name = "Microsoft.Web/serverfarms"
错误本身是矛盾的:所以,它期望 Microsoft.Web/serverFarms
,得到 Microsoft.Web/serverFarms
,但仍然有错误?
知道如何解决这个问题吗?
编辑
我最初编写 post 时使用的配置如下:
terraform {
backend "azurerm" { }
required_version = ">= 0.14"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.50.0"
}
}
}
我想这应该可以容纳任何更新。对吗?
将其更新到更新的版本(如下)导致了同样的错误。
terraform {
backend "azurerm" { }
required_version = ">= 0.15"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.72.0"
}
}
}
啊,我可以复制它 - 并修复它。它区分大小写...使用 "Microsoft.Web/serverFarms"
代替(大写 F)