From 15df876c2b1554acf67fde8810702a8b2dc2851b Mon Sep 17 00:00:00 2001 From: Maciej Murawski Date: Wed, 11 Feb 2026 13:24:09 +0000 Subject: [PATCH] feat: enable diagnostics for storage accounts --- infrastructure/modules/storage/main.tf | 11 +++++++++++ infrastructure/modules/storage/variables.tf | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/infrastructure/modules/storage/main.tf b/infrastructure/modules/storage/main.tf index 6dace3e0..7841a866 100644 --- a/infrastructure/modules/storage/main.tf +++ b/infrastructure/modules/storage/main.tf @@ -134,3 +134,14 @@ module "diagnostic-settings" { enabled_metric = var.monitor_diagnostic_setting_storage_account_metrics } + +module "diagnostic-settings-sa-resource" { + + source = "../diagnostic-settings" + + name = "${azurerm_storage_account.storage_account.name}-diagnotic-setting-storage-account" + target_resource_id = "${azurerm_storage_account.storage_account.id}" + log_analytics_workspace_id = var.log_analytics_workspace_id + enabled_metric = var.monitor_diagnostic_setting_storage_account_resource_metrics + +} diff --git a/infrastructure/modules/storage/variables.tf b/infrastructure/modules/storage/variables.tf index e6464430..d6e98811 100644 --- a/infrastructure/modules/storage/variables.tf +++ b/infrastructure/modules/storage/variables.tf @@ -74,12 +74,18 @@ variable "log_analytics_workspace_id" { variable "monitor_diagnostic_setting_storage_account_enabled_logs" { type = list(string) - description = "Controls what logs will be enabled for the storage" + description = "Controls what logs will be enabled for the storage services" } variable "monitor_diagnostic_setting_storage_account_metrics" { type = list(string) - description = "Controls what metrics will be enabled for the storage" + description = "Controls what metrics will be enabled for the storage services" +} + +variable "monitor_diagnostic_setting_storage_account_resource_metrics" { + type = list(string) + description = "Controls what metrics will be enabled for the storage account itself" + default = ["Transaction"] } variable "private_endpoint_properties" {