From dd35f11f55e03598131d7d3a560cc0d80ed4b518 Mon Sep 17 00:00:00 2001 From: Sanja Kosier <43904019+SKosier@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:32:44 +0200 Subject: [PATCH] feat(webhook-datasource): add enabling of Cloud pubsub API (SSPROD-45515) (#37) --- modules/services/webhook-datasource/main.tf | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/services/webhook-datasource/main.tf b/modules/services/webhook-datasource/main.tf index b86d4f7..a28709e 100644 --- a/modules/services/webhook-datasource/main.tf +++ b/modules/services/webhook-datasource/main.tf @@ -52,6 +52,17 @@ resource "google_project_iam_audit_config" "audit_config" { } } +#-------------------# +# Cloud Pub/Sub API # +#-------------------# + +resource "google_project_service" "pubsub_api" { + project = var.project_id + service = "pubsub.googleapis.com" + + disable_on_destroy = false +} + #-----------------# # Ingestion topic # #-----------------# @@ -61,6 +72,8 @@ resource "google_pubsub_topic" "ingestion_topic" { labels = var.labels project = var.project_id message_retention_duration = var.message_retention_duration + + depends_on = [google_project_service.pubsub_api] } resource "google_pubsub_topic" "deadletter_topic" { @@ -68,6 +81,8 @@ resource "google_pubsub_topic" "deadletter_topic" { project = var.project_id message_retention_duration = var.message_retention_duration + + depends_on = [google_project_service.pubsub_api] } #------# @@ -105,6 +120,8 @@ resource "google_pubsub_topic_iam_member" "publisher_iam_member" { topic = google_pubsub_topic.ingestion_topic.name role = "roles/pubsub.publisher" member = var.is_organizational ? google_logging_organization_sink.ingestion_sink[0].writer_identity : google_logging_project_sink.ingestion_sink[0].writer_identity + + depends_on = [google_project_service.pubsub_api] } #-------------------# @@ -156,6 +173,8 @@ resource "google_pubsub_subscription" "ingestion_topic_push_subscription" { dead_letter_topic = google_pubsub_topic.deadletter_topic.id max_delivery_attempts = var.max_delivery_attempts } + + depends_on = [google_project_service.pubsub_api] } #------------------------------------------------------------------#