When i run terraform plan or apply i always see, that my subnet will be deleted.
So, in resource i see that its connected to vnet and subnet:

i have TF code representation of that connection:
resource "azurerm_app_service_virtual_network_swift_connection" "func_app_vnet_swift_connection" {
app_service_id = azurerm_windows_function_app.func_app.id
subnet_id = data.azurerm_subnet.subnet.id
depends_on = [
azurerm_windows_function_app.func_app
]
}
In State i can see that block representation with the same subnet_id like from terraform plan command:
{
"mode": "managed",
"type": "azurerm_app_service_virtual_network_swift_connection",
"name": "func_app_vnet_swift_connection",
"provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
"instances": [
What is wrong with my code that it ALWAYS try to delete swift_connection block from resource? I need to do workaround (add and delete) an run apply twice to overcome that issue but it alwasy go back to me again





Update the azurerm_windows_function_app.func_app resource to have virtual_network_subnet_id argument included, which should refer to the subnet id (ie data.azurerm_subnet.subnet.id). This should resolve the issue. If it still does not work, please share the code block of azurerm_windows_function_app.func_app
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/windows_function_app#virtual_network_subnet_id