From 76dda7c79dc3e87fecf9ea1d809c9e72106b2a84 Mon Sep 17 00:00:00 2001 From: Hardik Desai Date: Wed, 17 Jun 2026 16:33:16 +0100 Subject: [PATCH 1/2] feat: add lifecycle ignore for data_collection_rule_id on LAW module --- infrastructure/modules/log-analytics-workspace/main.tf | 7 +++++++ .../modules/log-analytics-workspace/variables.tf | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/infrastructure/modules/log-analytics-workspace/main.tf b/infrastructure/modules/log-analytics-workspace/main.tf index d34ba77a..21276d43 100644 --- a/infrastructure/modules/log-analytics-workspace/main.tf +++ b/infrastructure/modules/log-analytics-workspace/main.tf @@ -12,6 +12,13 @@ resource "azurerm_log_analytics_workspace" "log_analytics_workspace" { } tags = var.tags + + # When data_collection_rule_id is managed externally (e.g. by azapi_update_resource + # to break a circular dependency with a workspace-transform DCR), changes to it + # must be ignored to prevent plan/apply churn. + lifecycle { + ignore_changes = [data_collection_rule_id] + } } /* -------------------------------------------------------------------------------------------------- diff --git a/infrastructure/modules/log-analytics-workspace/variables.tf b/infrastructure/modules/log-analytics-workspace/variables.tf index f2e0cae9..6be68956 100644 --- a/infrastructure/modules/log-analytics-workspace/variables.tf +++ b/infrastructure/modules/log-analytics-workspace/variables.tf @@ -42,3 +42,9 @@ variable "monitor_diagnostic_setting_log_analytics_workspace_metrics" { type = list(string) description = "Controls what metrics will be enabled for the Long Analytics Workspace" } + +variable "ignore_data_collection_rule_id" { + type = bool + default = false + description = "When true, ignores changes to data_collection_rule_id so it can be managed externally (e.g. by azapi_update_resource for workspace-transform DCRs)." +} From 1a9073015cb071ab3e8465207444ea58bd39b40d Mon Sep 17 00:00:00 2001 From: Hardik Desai Date: Thu, 18 Jun 2026 09:47:42 +0100 Subject: [PATCH 2/2] fix: remove unused ignore_data_collection_rule_id variable --- infrastructure/modules/log-analytics-workspace/variables.tf | 6 ------ 1 file changed, 6 deletions(-) diff --git a/infrastructure/modules/log-analytics-workspace/variables.tf b/infrastructure/modules/log-analytics-workspace/variables.tf index 6be68956..f2e0cae9 100644 --- a/infrastructure/modules/log-analytics-workspace/variables.tf +++ b/infrastructure/modules/log-analytics-workspace/variables.tf @@ -42,9 +42,3 @@ variable "monitor_diagnostic_setting_log_analytics_workspace_metrics" { type = list(string) description = "Controls what metrics will be enabled for the Long Analytics Workspace" } - -variable "ignore_data_collection_rule_id" { - type = bool - default = false - description = "When true, ignores changes to data_collection_rule_id so it can be managed externally (e.g. by azapi_update_resource for workspace-transform DCRs)." -}