Skip to content

Commit d457fa2

Browse files
authored
Merge pull request #12 from omartushevskyi/main
fix: added condition to data source
2 parents 9faf016 + ec6c359 commit d457fa2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ resource "azurerm_application_insights" "this" {
99
}
1010

1111
data "azurerm_monitor_diagnostic_categories" "this" {
12+
count = var.enable_diagnostic_setting ? 1 : 0
1213
resource_id = azurerm_linux_web_app.this.id
1314
}
1415

@@ -20,14 +21,14 @@ resource "azurerm_monitor_diagnostic_setting" "this" {
2021
log_analytics_destination_type = var.analytics_destination_type
2122

2223
dynamic "enabled_log" {
23-
for_each = data.azurerm_monitor_diagnostic_categories.this.log_category_types
24+
for_each = data.azurerm_monitor_diagnostic_categories.this[0].log_category_types
2425
content {
2526
category = enabled_log.value
2627
}
2728
}
2829

2930
dynamic "metric" {
30-
for_each = data.azurerm_monitor_diagnostic_categories.this.metrics
31+
for_each = data.azurerm_monitor_diagnostic_categories.this[0].metrics
3132
content {
3233
category = metric.value
3334
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
azurerm = {
66
source = "hashicorp/azurerm"
7-
version = ">= 3.23.0"
7+
version = ">= 3.40.0"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)