File tree Expand file tree Collapse file tree
mysql_flexible_server_public Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,11 +33,6 @@ resource "azurerm_analysis_services_server" "server" {
3333 }
3434}
3535
36- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
37- count = var. log_analytics_workspace_id == null ? 0 : 1
38- resource_id = azurerm_analysis_services_server. server . id
39- }
40-
4136resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
4237 count = var. log_analytics_workspace_id == null ? 0 : 1
4338 name = " diag-${ var . name } "
@@ -47,28 +42,12 @@ resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
4742 // TODO: not yet implemented by Azure
4843 // log_analytics_destination_type = "Dedicated"
4944
50- dynamic "enabled_log" {
51- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types
52-
53- content {
54- category = enabled_log. value
55-
56- retention_policy {
57- enabled = false
58- }
59- }
45+ enabled_log {
46+ category_group = " allLogs"
6047 }
6148
62- dynamic "metric" {
63- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics
64-
65- content {
66- category = metric. value
67- enabled = true
68-
69- retention_policy {
70- enabled = false
71- }
72- }
49+ metric {
50+ category = " AllMetrics"
51+ enabled = true
7352 }
7453}
Original file line number Diff line number Diff line change @@ -120,41 +120,20 @@ resource "azurerm_api_management_diagnostic" "apim_diagnostic" {
120120 }
121121}
122122
123- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
124- count = var. log_analytics_workspace_id == null ? 0 : 1
125- resource_id = azurerm_api_management. api_management . id
126- }
127-
128123// Write logs and metrics to log analytics if specified
129124resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
130125 count = var. log_analytics_workspace_id == null ? 0 : 1
131126 name = " diag-${ azurerm_api_management . api_management . name } "
132127 target_resource_id = azurerm_api_management. api_management . id
133128 log_analytics_workspace_id = var. log_analytics_workspace_id
134129
135- dynamic "enabled_log" {
136- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types
137-
138- content {
139- category = enabled_log. value
140-
141- retention_policy {
142- enabled = false
143- }
144- }
130+ enabled_log {
131+ category_group = " allLogs"
145132 }
146133
147- dynamic "metric" {
148- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics
149-
150- content {
151- category = metric. value
152- enabled = true
153-
154- retention_policy {
155- enabled = false
156- }
157- }
134+ metric {
135+ category = " AllMetrics"
136+ enabled = true
158137 }
159138}
160139
Original file line number Diff line number Diff line change @@ -118,11 +118,6 @@ resource "azurerm_storage_account_network_rules" "storage_account_network_rules"
118118 bypass = [" Logging" , " Metrics" , " AzureServices" ]
119119}
120120
121- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
122- count = var. log_analytics_workspace_id == null ? 0 : 1
123- resource_id = azurerm_storage_account. storage_account . id
124- }
125-
126121resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
127122 count = var. log_analytics_workspace_id == null ? 0 : 1
128123 name = " diag-${ var . name } "
@@ -132,28 +127,12 @@ resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
132127 // TODO: not yet implemented by Azure
133128 // log_analytics_destination_type = "Dedicated"
134129
135- dynamic "enabled_log" {
136- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types
137-
138- content {
139- category = enabled_log. value
140-
141- retention_policy {
142- enabled = false
143- }
144- }
130+ enabled_log {
131+ category_group = " allLogs"
145132 }
146133
147- dynamic "metric" {
148- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics
149-
150- content {
151- category = metric. value
152- enabled = true
153-
154- retention_policy {
155- enabled = false
156- }
157- }
134+ metric {
135+ category = " AllMetrics"
136+ enabled = true
158137 }
159138}
Original file line number Diff line number Diff line change @@ -23,32 +23,19 @@ resource "azurerm_eventgrid_system_topic" "topic" {
2323 topic_type = var. topic_type
2424}
2525
26- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
27- count = var. loganalytics_diagnostic_setting == null ? 0 : 1
28- resource_id = azurerm_eventgrid_system_topic. topic . id
29- }
30-
3126resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
3227 count = var. loganalytics_diagnostic_setting == null ? 0 : 1
3328 name = " diag-${ var . topic_name } "
3429 target_resource_id = azurerm_eventgrid_system_topic. topic . id
3530 log_analytics_workspace_id = var. loganalytics_diagnostic_setting . workspace_id
3631
3732
38- dynamic "enabled_log" {
39- for_each = var. loganalytics_diagnostic_setting . categories == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types : var. loganalytics_diagnostic_setting . categories
40-
41- content {
42- category = enabled_log. value
43- }
33+ enabled_log {
34+ category_group = " allLogs"
4435 }
4536
46- dynamic "metric" {
47- for_each = var. loganalytics_diagnostic_setting . metrics == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics : var. loganalytics_diagnostic_setting . metrics
48-
49- content {
50- category = metric. value
51- enabled = true
52- }
37+ metric {
38+ category = " AllMetrics"
39+ enabled = true
5340 }
5441}
Original file line number Diff line number Diff line change @@ -39,32 +39,19 @@ resource "azurerm_eventhub_consumer_group" "consumer" {
3939}
4040
4141
42- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
43- count = var. loganalytics_diagnostic_setting == null ? 0 : 1
44- resource_id = azurerm_eventhub_namespace. namespace . id
45- }
46-
4742resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
4843 count = var. loganalytics_diagnostic_setting == null ? 0 : 1
4944 name = " diag-${ var . namespace_name } "
5045 target_resource_id = azurerm_eventhub_namespace. namespace . id
5146 log_analytics_workspace_id = var. loganalytics_diagnostic_setting . workspace_id
5247 log_analytics_destination_type = var. loganalytics_diagnostic_setting . destination_type == null ? null : var. loganalytics_diagnostic_setting . destination_type
5348
54- dynamic "enabled_log" {
55- for_each = var. loganalytics_diagnostic_setting . categories == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types : var. loganalytics_diagnostic_setting . categories
56-
57- content {
58- category = enabled_log. value
59- }
49+ enabled_log {
50+ category_group = " allLogs"
6051 }
6152
62- dynamic "metric" {
63- for_each = var. loganalytics_diagnostic_setting . metrics == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics : var. loganalytics_diagnostic_setting . metrics
64-
65- content {
66- category = metric. value
67- enabled = true
68- }
53+ metric {
54+ category = " AllMetrics"
55+ enabled = true
6956 }
7057}
Original file line number Diff line number Diff line change @@ -141,11 +141,6 @@ resource "azurerm_frontdoor" "frontdoor" {
141141 }
142142}
143143
144- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
145- count = var. log_analytics_workspace_id == null ? 0 : 1
146- resource_id = azurerm_frontdoor. frontdoor . id
147- }
148-
149144resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
150145 count = var. log_analytics_workspace_id == null ? 0 : 1
151146 name = " diag-${ var . name } "
@@ -155,29 +150,13 @@ resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
155150 // TODO: not yet implemented by Azure
156151 // log_analytics_destination_type = "Dedicated"
157152
158- dynamic "enabled_log" {
159- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types
160-
161- content {
162- category = enabled_log. value
163-
164- retention_policy {
165- enabled = false
166- }
167- }
153+ enabled_log {
154+ category_group = " allLogs"
168155 }
169156
170- dynamic "metric" {
171- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics
172-
173- content {
174- category = metric. value
175- enabled = true
176-
177- retention_policy {
178- enabled = false
179- }
180- }
157+ metric {
158+ category = " AllMetrics"
159+ enabled = true
181160 }
182161}
183162
Original file line number Diff line number Diff line change @@ -172,34 +172,18 @@ resource "azurerm_cdn_frontdoor_security_policy" "fd_security_policy" {
172172}
173173
174174# Diagnostic settings
175- data "azurerm_monitor_diagnostic_categories" "fd_categories" {
176- count = var. log_analytics_workspace_id == null ? 0 : 1
177- resource_id = azurerm_cdn_frontdoor_profile. fd_profile . id
178- }
179-
180175resource "azurerm_monitor_diagnostic_setting" "fd_diagnostics" {
181176 count = var. log_analytics_workspace_id == null ? 0 : 1
182177 name = " diag-${ var . name } "
183178 target_resource_id = azurerm_cdn_frontdoor_profile. fd_profile . id
184179 log_analytics_workspace_id = var. log_analytics_workspace_id
185180
186- dynamic "enabled_log" {
187- for_each = data. azurerm_monitor_diagnostic_categories . fd_categories [0 ]. log_category_types
188- content {
189- category = enabled_log. value
190- retention_policy {
191- enabled = false
192- }
193- }
181+ enabled_log {
182+ category_group = " allLogs"
194183 }
195184
196- dynamic "metric" {
197- for_each = data. azurerm_monitor_diagnostic_categories . fd_categories [0 ]. metrics
198- content {
199- category = metric. value
200- retention_policy {
201- enabled = false
202- }
203- }
185+ metric {
186+ category = " AllMetrics"
187+ enabled = true
204188 }
205189}
Original file line number Diff line number Diff line change @@ -82,11 +82,6 @@ resource "azurerm_key_vault" "key_vault" {
8282 }
8383}
8484
85- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
86- count = var. log_analytics_workspace_id == null ? 0 : 1
87- resource_id = azurerm_key_vault. key_vault . id
88- }
89-
9085resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
9186 count = var. log_analytics_workspace_id == null ? 0 : 1
9287 name = " diag-${ var . name } "
@@ -96,28 +91,12 @@ resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
9691 // TODO: not yet implemented by Azure
9792 // log_analytics_destination_type = "Dedicated"
9893
99- dynamic "enabled_log" {
100- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types
101-
102- content {
103- category = enabled_log. value
104-
105- retention_policy {
106- enabled = false
107- }
108- }
94+ enabled_log {
95+ category_group = " allLogs"
10996 }
11097
111- dynamic "metric" {
112- for_each = data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics
113-
114- content {
115- category = metric. value
116- enabled = true
117-
118- retention_policy {
119- enabled = false
120- }
121- }
98+ metric {
99+ category = " AllMetrics"
100+ enabled = true
122101 }
123102}
Original file line number Diff line number Diff line change @@ -26,33 +26,20 @@ resource "azurerm_log_analytics_workspace" "workspace" {
2626
2727
2828
29- data "azurerm_monitor_diagnostic_categories" "diagnostic_categories" {
30- count = var. loganalytics_diagnostic_setting == null ? 0 : 1
31- resource_id = azurerm_log_analytics_workspace. workspace . id
32- }
33-
3429resource "azurerm_monitor_diagnostic_setting" "diagnostic_setting" {
3530 count = var. loganalytics_diagnostic_setting == null ? 0 : 1
3631 name = " diag-${ var . name } "
3732 target_resource_id = azurerm_log_analytics_workspace. workspace . id
3833 log_analytics_workspace_id = azurerm_log_analytics_workspace. workspace . id
3934 log_analytics_destination_type = var. loganalytics_diagnostic_setting . destination_type == null ? null : var. loganalytics_diagnostic_setting . destination_type
4035
41- dynamic "enabled_log" {
42- for_each = var. loganalytics_diagnostic_setting . categories == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. log_category_types : var. loganalytics_diagnostic_setting . categories
43-
44- content {
45- category = enabled_log. value
46- }
36+ enabled_log {
37+ category_group = " allLogs"
4738 }
4839
49- dynamic "metric" {
50- for_each = var. loganalytics_diagnostic_setting . metrics == null ? data. azurerm_monitor_diagnostic_categories . diagnostic_categories [0 ]. metrics : var. loganalytics_diagnostic_setting . metrics
51-
52- content {
53- category = metric. value
54- enabled = true
55- }
40+ metric {
41+ category = " AllMetrics"
42+ enabled = true
5643 }
5744}
5845
You can’t perform that action at this time.
0 commit comments