I am trying to setup VNet integration for an Azure App Service (web app) via terraform, and the below is the code I have been using:
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"
}
}
}
... and I am getting the following error:
> 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"
The error itself is contradictive : so, it expects Microsoft.Web/serverFarms, gets Microsoft.Web/serverFarms, but still errors?
Any idea how can I fix this?
EDIT
The configuration I was using when I initially wrote the post is the following:
terraform {
backend "azurerm" { }
required_version = ">= 0.14"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.50.0"
}
}
}
Which should accommodate for any updates, I guess. Right?
Updating it to more recent versions (below) resulted in the same error.
terraform {
backend "azurerm" { }
required_version = ">= 0.15"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.72.0"
}
}
}