Skip to content

Commit

Permalink
replace log with enabled_log (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
heoelri authored Jul 5, 2023
1 parent de40422 commit 60b7a69
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ resource "azurerm_monitor_diagnostic_setting" "diag_settings_afd" {
target_resource_id = azurerm_frontdoor.afdgrafana.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.frontdoor.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -44,13 +43,12 @@ resource "azurerm_monitor_diagnostic_setting" "acr" {
target_resource_id = azurerm_container_registry.main.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.acr.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
18 changes: 6 additions & 12 deletions src/infra/monitoring/grafana/terraform/stamps/la-wspace-config.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ resource "azurerm_monitor_diagnostic_setting" "appservice" {
target_resource_id = azurerm_linux_web_app.appservice[each.key].id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace[each.key].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.appservice[each.key].log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -45,13 +44,12 @@ resource "azurerm_monitor_diagnostic_setting" "pgprimary" {
target_resource_id = azurerm_postgresql_server.pgprimary.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace["primary"].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.pgprimary.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -82,13 +80,12 @@ resource "azurerm_monitor_diagnostic_setting" "pgreplica" {
target_resource_id = azurerm_postgresql_server.pgreplica.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace["secondary"].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.pgreplica.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -121,13 +118,12 @@ resource "azurerm_monitor_diagnostic_setting" "vnet" {
target_resource_id = azurerm_virtual_network.vnet[each.key].id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace[each.key].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.vnet[each.key].log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -160,13 +156,12 @@ resource "azurerm_monitor_diagnostic_setting" "asp" {
target_resource_id = azurerm_service_plan.asp[each.key].id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace[each.key].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.asp[each.key].log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -199,13 +194,12 @@ resource "azurerm_monitor_diagnostic_setting" "akv" {
target_resource_id = azurerm_key_vault.stamp[each.key].id
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_workspace[each.key].id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.akv[each.key].log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/globalresources/acr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ resource "azurerm_monitor_diagnostic_setting" "acr" {
target_resource_id = azurerm_container_registry.main.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.global.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.acr.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/globalresources/cosmosdb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ resource "azurerm_monitor_diagnostic_setting" "cosmosdb" {
log_analytics_workspace_id = azurerm_log_analytics_workspace.global.id
log_analytics_destination_type = "AzureDiagnostics"

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.cosmosdb.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/globalresources/frontdoor.tf
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,12 @@ resource "azurerm_monitor_diagnostic_setting" "frontdoor" {
target_resource_id = azurerm_cdn_frontdoor_profile.main.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.global.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.frontdoor.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/globalresources/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ resource "azurerm_monitor_diagnostic_setting" "storage_global" {
target_resource_id = azurerm_storage_account.global.id
log_analytics_workspace_id = azurerm_log_analytics_workspace.global.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.global_public.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/releaseunit/modules/stamp/eventhub.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ resource "azurerm_monitor_diagnostic_setting" "eventhub" {
target_resource_id = azurerm_eventhub_namespace.stamp.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.eventhub.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/releaseunit/modules/stamp/keyvault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ resource "azurerm_monitor_diagnostic_setting" "kv" {
target_resource_id = azurerm_key_vault.stamp.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.kv.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
3 changes: 1 addition & 2 deletions src/infra/workload/releaseunit/modules/stamp/kubernetes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,12 @@ resource "azurerm_monitor_diagnostic_setting" "aks" {
target_resource_id = azurerm_kubernetes_cluster.stamp.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.aks.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down
12 changes: 4 additions & 8 deletions src/infra/workload/releaseunit/modules/stamp/storage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ resource "azurerm_monitor_diagnostic_setting" "storage_public" {
target_resource_id = azurerm_storage_account.public.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.storage_public.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -126,13 +125,12 @@ resource "azurerm_monitor_diagnostic_setting" "storage_public_blob" {
target_resource_id = "${azurerm_storage_account.public.id}/blobServices/default/"
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.storage_public_blob.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -169,13 +167,12 @@ resource "azurerm_monitor_diagnostic_setting" "storage_private" {
target_resource_id = azurerm_storage_account.private.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.storage_private.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down Expand Up @@ -209,13 +206,12 @@ resource "azurerm_monitor_diagnostic_setting" "storage_private_blob" {
target_resource_id = "${azurerm_storage_account.private.id}/blobServices/default/"
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.stamp.id

dynamic "log" {
dynamic "enabled_log" {
iterator = entry
for_each = data.azurerm_monitor_diagnostic_categories.storage_private_blob.log_category_types

content {
category = entry.value
enabled = true

retention_policy {
enabled = true
Expand Down

0 comments on commit 60b7a69

Please sign in to comment.