I'm experiencing unusually long delays when managing an Azure Container App Environment (ACA Environment), both when deleting it through Terraform and the Azure Portal. Specifically, deleting the ACA Environment consistently takes more than 20 minutes. This seems strange because the associated resources (such as virtual networks and subnets) are relatively simple.
Here’s a simplified version of my Terraform configuration:
resource "azurerm_virtual_network" "virtual_network" {
name = "vnet-${var.environment}-${var.location}-001"
address_space = ["10.0.0.0/16"]
location = var.location
resource_group_name = azurerm_resource_group.resource_group.name
tags = local.global_tags
}
resource "azurerm_subnet" "apis_subnet" {
name = "snet-apis-${var.location}-001"
resource_group_name = azurerm_resource_group.resource_group.name
virtual_network_name = azurerm_virtual_network.virtual_network.name
address_prefixes = ["10.0.1.0/24"]
delegation {
name = "delegation"
service_delegation {
name = "Microsoft.App/environments"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
}
}
lifecycle {
prevent_destroy = false
ignore_changes = [address_prefixes]
}
}
resource "azurerm_container_app_environment" "container_app_environment" {
name = "cae-something-${var.location}-${var.environment}-001"
location = var.location
resource_group_name = azurerm_resource_group.resource_group.name
infrastructure_subnet_id = azurerm_subnet.apis_subnet.id
workload_profile {
name = "Consumption"
workload_profile_type = "Consumption"
}
}
What I've Observed
What I Want to Know
If you’ve run into something similar or have ideas on what might be causing this, I’d really appreciate your help!
Azure Container App Environment deletion takes over 20 minutes – Is this normal, and how can it be optimized?
The Azure Container App Environment takes a longer time for resource creation and deletion, typically when the associated resources (like the VNet and subnet) are simple configurations. Deletion times can vary depending on several factors, such as the presence of active workloads, network configurations, or Azure platform performance at the time.
Terraform also gives a default of 30 minutes to delete an Azure Container App. Follow the link for more details

Even when I tried to delete the ACA using Terraform, it took 21 minutes to delete.

To better understand what Terraform is doing during the deletion process, enable Terraform debugging
$env:TF_LOG="DEBUG"
terraform destroy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With