-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiagnostics.tf
29 lines (27 loc) · 1.12 KB
/
diagnostics.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting_application_insights" {
for_each = { for index, value in var.diagnostics_configurations :
index => {
log_analytics_workspace_id = value.log_analytics_workspace_id,
storage_account_id = value.storage_account_id
}
}
name = "applicationLogs-${each.key}"
target_resource_id = azurerm_application_insights.application_insights.id
log_analytics_workspace_id = each.value.log_analytics_workspace_id == "" ? null : each.value.log_analytics_workspace_id
storage_account_id = each.value.storage_account_id == "" ? null : each.value.storage_account_id
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.diagnostic_categories_application_insights.log_category_groups
content {
category_group = entry.value
}
}
dynamic "metric" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.diagnostic_categories_application_insights.metrics
content {
category = entry.value
enabled = true
}
}
}