From 0fa2e7fc3f62458540b83adef3cb072678a5681e Mon Sep 17 00:00:00 2001 From: Marcus Robinson Date: Tue, 30 Jun 2026 10:53:12 +0000 Subject: [PATCH] Fix intermittent workspace deletion failure on AMPLS private DNS zone group (#3194) --- CHANGELOG.md | 3 + templates/workspaces/base/porter.yaml | 2 +- .../terraform/azure-monitor/azure-monitor.tf | 73 ++++++++++++++++--- 3 files changed, 66 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef9339b2b8..5ace18d2a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ ENHANCEMENTS: * Add support for setting resource processor VMSS SKU via environment variables ([#4936](https://github.com/microsoft/AzureTRE/issues/4936)) * Exclude recovery service vaults from e2e tests ([#4920](https://github.com/microsoft/AzureTRE/issues/4920)) +BUG FIXES: +* Fix intermittent workspace deletion failure caused by `AnotherOperationInProgress` 409 errors on the Azure Monitor (AMPLS) private DNS zone group, by adding an azapi delete retry. ([#3194](https://github.com/microsoft/AzureTRE/issues/3194)) + ## (0.28.0) (March 2, 2026) **BREAKING CHANGES** * Sonatype Nexus shared service now requires explicit EULA acceptance (`accept_nexus_eula: true`) when deploying. This ensures compliance with Sonatype Nexus Community Edition licensing. ([#4842](https://github.com/microsoft/AzureTRE/issues/4842)) diff --git a/templates/workspaces/base/porter.yaml b/templates/workspaces/base/porter.yaml index 368df54022..22cb6cdfc3 100644 --- a/templates/workspaces/base/porter.yaml +++ b/templates/workspaces/base/porter.yaml @@ -1,7 +1,7 @@ --- schemaVersion: 1.0.0 name: tre-workspace-base -version: 2.8.3 +version: 2.8.4 description: "A base Azure TRE workspace" dockerfile: Dockerfile.tmpl registry: azuretre diff --git a/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf b/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf index 08822baa80..73203b8eb3 100644 --- a/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf +++ b/templates/workspaces/base/terraform/azure-monitor/azure-monitor.tf @@ -180,20 +180,71 @@ resource "azurerm_private_endpoint" "azure_monitor_private_endpoint" { is_manual_connection = false } - private_dns_zone_group { - name = "azure-monitor-private-dns-zone-group" - - private_dns_zone_ids = [ - var.azure_monitor_dns_zone_id, - var.azure_monitor_oms_opinsights_dns_zone_id, - var.azure_monitor_ods_opinsights_dns_zone_id, - var.azure_monitor_agentsvc_dns_zone_id, - var.blob_core_dns_zone_id, - ] + depends_on = [ + azurerm_monitor_private_link_scoped_service.ampls_app_insights, + azurerm_monitor_private_link_scoped_service.ampls_log_anaytics, + ] +} + +# Separate DNS zone group using azapi to avoid AnotherOperationInProgress errors +# See: https://github.com/hashicorp/terraform-provider-azurerm/issues/28715 +resource "azapi_resource" "azure_monitor_dns_zone_group" { + type = "Microsoft.Network/privateEndpoints/privateDnsZoneGroups@2023-11-01" + name = "azure-monitor-private-dns-zone-group" + parent_id = azurerm_private_endpoint.azure_monitor_private_endpoint.id + + body = { + properties = { + privateDnsZoneConfigs = [ + { + name = "privatelink-monitor-azure-com" + properties = { + privateDnsZoneId = var.azure_monitor_dns_zone_id + } + }, + { + name = "privatelink-oms-opinsights-azure-com" + properties = { + privateDnsZoneId = var.azure_monitor_oms_opinsights_dns_zone_id + } + }, + { + name = "privatelink-ods-opinsights-azure-com" + properties = { + privateDnsZoneId = var.azure_monitor_ods_opinsights_dns_zone_id + } + }, + { + name = "privatelink-agentsvc-azure-automation-net" + properties = { + privateDnsZoneId = var.azure_monitor_agentsvc_dns_zone_id + } + }, + { + name = "privatelink-blob-core-windows-net" + properties = { + privateDnsZoneId = var.blob_core_dns_zone_id + } + } + ] + } + } + + response_export_values = ["id"] + + retry = { + error_message_regex = ["AnotherOperationInProgress", "Another operation on this or dependent resource is in progress"] + interval_seconds = 15 + max_interval_seconds = 90 + } + + timeouts { + create = "30m" + delete = "30m" } depends_on = [ - azurerm_monitor_private_link_scoped_service.ampls_app_insights, + azurerm_private_endpoint.azure_monitor_private_endpoint, ] }