File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,41 @@ resource "azurerm_service_plan" "service_plan" {
1212 zone_balancing_enabled = false # Update to 'true' for production
1313}
1414
15+ data "azurerm_monitor_diagnostic_categories" "diagnostic_categories_service_plan" {
16+ resource_id = azurerm_service_plan. service_plan . id
17+ }
18+
19+ resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting_service_plan" {
20+ name = " logAnalytics"
21+ target_resource_id = azurerm_service_plan. service_plan . id
22+ log_analytics_workspace_id = azurerm_log_analytics_workspace. log_analytics_workspace . id
23+
24+ dynamic "enabled_log" {
25+ iterator = entry
26+ for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories_service_plan . log_category_groups
27+ content {
28+ category_group = entry. value
29+ retention_policy {
30+ enabled = true
31+ days = 30
32+ }
33+ }
34+ }
35+
36+ dynamic "metric" {
37+ iterator = entry
38+ for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories_service_plan . metrics
39+ content {
40+ category = entry. value
41+ enabled = true
42+ retention_policy {
43+ enabled = true
44+ days = 30
45+ }
46+ }
47+ }
48+ }
49+
1550resource "azapi_resource" "function" {
1651 type = " Microsoft.Web/sites@2022-09-01"
1752 parent_id = azurerm_resource_group. app_rg . id
You can’t perform that action at this time.
0 commit comments