Skip to content

Commit

Permalink
Ensure diagnostic settings are created correctly in organization inst…
Browse files Browse the repository at this point in the history
…alls (#59)
  • Loading branch information
nkraemer-sysdig authored Sep 6, 2024
1 parent 762ed8c commit 158c92e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/integrations/event-hub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ resource "azurerm_role_assignment" "sysdig_data_receiver" {
# Create diagnostic settings for the subscription
#---------------------------------------------------------------------------------------------
resource "azurerm_monitor_diagnostic_setting" "sysdig_diagnostic_setting" {
count = length(var.enabled_platform_logs) > 0 ? 1 : 0
count = length(var.enabled_platform_logs) > 0 && !var.is_organizational ? 1 : 0

name = "${var.diagnostic_settings_name}-${random_string.random.result}-${local.subscription_hash}"
target_resource_id = data.azurerm_subscription.sysdig_subscription.id
Expand Down
2 changes: 1 addition & 1 deletion modules/integrations/event-hub/organizational.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ locals {
resource "azurerm_monitor_diagnostic_setting" "sysdig_org_diagnostic_setting" {
count = var.is_organizational ? length(local.enabled_subscriptions) : 0

name = "${var.diagnostic_settings_name}-${local.subscription_hash}"
name = "${var.diagnostic_settings_name}-${substr(md5(local.enabled_subscriptions[count.index].id), 0, 8)}"
target_resource_id = local.enabled_subscriptions[count.index].id
eventhub_authorization_rule_id = azurerm_eventhub_namespace_authorization_rule.sysdig_rule.id
eventhub_name = azurerm_eventhub.sysdig_event_hub.name
Expand Down

0 comments on commit 158c92e

Please sign in to comment.