Skip to content

Commit 4301760

Browse files
fix(routing-key): enable routing key generation in a deterministic way
1 parent 91a33e4 commit 4301760

File tree

1 file changed

+7
-4
lines changed
  • modules/integrations/pub-sub

1 file changed

+7
-4
lines changed

modules/integrations/pub-sub/main.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,16 @@ data "sysdig_secure_tenant_external_id" "external_id" {}
2424

2525
data "sysdig_secure_cloud_ingestion_assets" "assets" {}
2626

27-
data "sysdig_current_user" "user" {}
2827
#-----------------------------------------------------------------------------------------
2928
# These locals indicate the suffix to create unique name for resources
3029
#-----------------------------------------------------------------------------------------
3130
locals {
3231
suffix = var.suffix == null ? random_id.suffix[0].hex : var.suffix
3332
role_name = "SysdigIngestionAuthRole"
34-
key_name = "${var.project_id}-${data.sysdig_current_user.user.id}"
35-
routing_key = uuidv5("oid", local.key_name)
33+
routing_key = random_uuid.routing_key.result
3634
ingestion_url = "${regex("^(.*)/[^/]+$", data.sysdig_secure_cloud_ingestion_assets.assets.gcp_metadata.ingestionURL)[0]}/${local.routing_key}"
3735
}
3836

39-
4037
#-----------------------------------------------------------------------------------------------------------------------
4138
# A random resource is used to generate unique Pub Sub name suffix for resources.
4239
# This prevents conflicts when recreating a Pub Sub resources with the same name.
@@ -46,6 +43,12 @@ resource "random_id" "suffix" {
4643
byte_length = 3
4744
}
4845

46+
47+
#-----------------------------------------------------------------------------------------------------------------------
48+
# A random UUID is used to generate a unique identifier for the routing key per onboarded entity.
49+
#-----------------------------------------------------------------------------------------------------------------------
50+
resource "random_uuid" "routing_key" {}
51+
4952
#-----------------------------------------------------------------------------------------
5053
# Audit Logs
5154
#-----------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)