Skip to content

Commit

Permalink
Add subscription id hash to event hub namespace name (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteopasa authored Jan 9, 2024
1 parent 5838afe commit fce1d50
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/services/event-hub-data-source/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ data "azurerm_subscription" "sysdig_subscription" {
subscription_id = var.subscription_id
}

# Generate a unique hash for the subscription ID
locals {
subscription_hash = substr(md5(data.azurerm_client_config.current.subscription_id), 0, 8)
}

#---------------------------------------------------------------------------------------------
# Create service principal in customer tenant
#---------------------------------------------------------------------------------------------
Expand All @@ -28,7 +33,7 @@ resource "azurerm_resource_group" "sysdig_resource_group" {
# Create an Event Hub Namespace for Sysdig
#---------------------------------------------------------------------------------------------
resource "azurerm_eventhub_namespace" "sysdig_event_hub_namespace" {
name = var.event_hub_namespace_name
name = "${var.event_hub_namespace_name}-${local.subscription_hash}"
location = azurerm_resource_group.sysdig_resource_group.location
resource_group_name = azurerm_resource_group.sysdig_resource_group.name
sku = var.namespace_sku
Expand Down

0 comments on commit fce1d50

Please sign in to comment.