Skip to content

Commit

Permalink
feat(data-ingestor-iam): Add module (#57)
Browse files Browse the repository at this point in the history
New module to configure IAM policies for the data ingestor, allowing it to subscribe to a Pub/Sub topic for ingestion
  • Loading branch information
royal authored Mar 1, 2024
1 parent a93b55b commit 4df9111
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gcp/data-ingestor-iam/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
locals {
data_ingestor_subscriber = {
preview = "serviceAccount:[email protected]",
preprod = "serviceAccount:[email protected]",
prod = "serviceAccount:[email protected]",
}
}

resource "google_pubsub_topic_iam_member" "data_ingestor_subscriber" {
topic = var.topic
role = "roles/pubsub.subscriber"
member = local.data_ingestor_subscriber[var.environment]
}
14 changes: 14 additions & 0 deletions gcp/data-ingestor-iam/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
variable "environment" {
type = string
description = "Environment that can be preview, preprod, dev or prod"

validation {
condition = contains(["preview", "preprod", "prod", "dev"], var.environment)
error_message = "The environment must be one of: preview, preprod, dev or prod."
}
}

variable "topic" {
type = string
description = "The Pub/Sub topic ID in projects/{{PROJECT_ID}}/topics/{{TOPIC_NAME}} format"
}

0 comments on commit 4df9111

Please sign in to comment.