From a0420cf976ebeb92be141ea2b8acc751b17ec94b Mon Sep 17 00:00:00 2001 From: jose-pablo-camacho Date: Thu, 19 Sep 2024 13:53:45 -0600 Subject: [PATCH] enhance(modular): add unique naming for ingestion_topic name (#41) * enhance(modular): add unique naming for ingestion_topic name * enhance(modular): fix iam member vs iam binding authoritative issue --- modules/integrations/pub-sub/main.tf | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/integrations/pub-sub/main.tf b/modules/integrations/pub-sub/main.tf index afe2c9e..f3d717a 100644 --- a/modules/integrations/pub-sub/main.tf +++ b/modules/integrations/pub-sub/main.tf @@ -73,14 +73,14 @@ resource "google_project_iam_audit_config" "audit_config" { # Ingestion Topic #----------------------------------------------------------------------------------------- resource "google_pubsub_topic" "ingestion_topic" { - name = "ingestion_topic" + name = "ingestion_topic_${local.suffix}" labels = var.labels project = var.project_id message_retention_duration = var.message_retention_duration } resource "google_pubsub_topic" "deadletter_topic" { - name = "dl-${google_pubsub_topic.ingestion_topic.name}" + name = "dl_${google_pubsub_topic.ingestion_topic.name}" project = var.project_id message_retention_duration = var.message_retention_duration } @@ -128,13 +128,10 @@ resource "google_service_account" "push_auth" { project = var.project_id } -resource "google_service_account_iam_binding" "push_auth_binding" { +resource "google_service_account_iam_member" "push_auth_binding" { service_account_id = google_service_account.push_auth.name role = "roles/iam.workloadIdentityUser" - - members = [ - "serviceAccount:${google_service_account.push_auth.email}", - ] + member = "serviceAccount:${google_service_account.push_auth.email}" } resource "google_pubsub_subscription" "ingestion_topic_push_subscription" {