From 4d0985d08790ca22a78e7500a0751a3416a195cc Mon Sep 17 00:00:00 2001
From: Ravina Dhruve <136399755+ravinadhruve10@users.noreply.github.com>
Date: Thu, 11 Jan 2024 10:53:24 -0800
Subject: [PATCH] feat: Add module outputs for webhook-datasource (#17)
* feat: Add module outputs for webhook-datasource
* Fix sink index for project and org cases
---
modules/services/webhook-datasource/README.md | 3 +++
modules/services/webhook-datasource/outputs.tf | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/modules/services/webhook-datasource/README.md b/modules/services/webhook-datasource/README.md
index 0532d90..71a2c09 100644
--- a/modules/services/webhook-datasource/README.md
+++ b/modules/services/webhook-datasource/README.md
@@ -62,3 +62,6 @@ No modules.
| Name | Description |
|------|-------------|
| [push\_endpoint](#output\_push\_endpoint) | Push endpoint towards which the POST request will be directed |
+| [ingestion\_pubsub\_topic\_name](#output\_ingestion\_pubsub\_topic\_name) | PubSub ingestion topic that will hold all the AuditLogs coming from the specified project |
+| [ingestion\_sink\_name](#output\_ingestion\_sink\_name) | Project/Organization sink to direct the AuditLogs towards a dedicated PubSub topic |
+| [ingestion\_push\_subscription\_name](#output\_ingestion\_push\_subscription\_name) | Push Subscription that will POST the AuditLogs collected from the project towards Sysdig's backend |
diff --git a/modules/services/webhook-datasource/outputs.tf b/modules/services/webhook-datasource/outputs.tf
index 129f542..b726ec3 100644
--- a/modules/services/webhook-datasource/outputs.tf
+++ b/modules/services/webhook-datasource/outputs.tf
@@ -2,3 +2,18 @@ output "push_endpoint" {
value = google_pubsub_subscription.ingestion_topic_push_subscription.push_config[0].push_endpoint
description = "Push endpoint towards which the POST request will be directed"
}
+
+output "ingestion_pubsub_topic_name" {
+ value = google_pubsub_topic.ingestion_topic.name
+ description = "PubSub ingestion topic that will hold all the AuditLogs coming from the specified project"
+}
+
+output "ingestion_sink_name" {
+ value = var.is_organizational ? google_logging_organization_sink.ingestion_sink[0].name : google_logging_project_sink.ingestion_sink[0].name
+ description = "Project/Organization sink to direct the AuditLogs towards a dedicated PubSub topic"
+}
+
+output "ingestion_push_subscription_name" {
+ value = google_pubsub_subscription.ingestion_topic_push_subscription.name
+ description = "Push Subscription that will POST the AuditLogs collected from the project towards Sysdig's backend"
+}