Skip to content

Commit

Permalink
fix: Add necessary IAM permissions to Splunk Sink example (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jberlinsky authored Apr 3, 2020
1 parent 02414e1 commit b0b0619
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions examples/splunk-sink/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,28 @@ module "destination" {
log_sink_writer_identity = module.log_export.writer_identity
create_subscriber = true
}

resource "google_project_iam_custom_role" "consumer" {
project = var.project_id
role_id = "SplunkSink"
title = "Splunk Sink"
description = "Grant Splunk Addon for GCP permission to see the project and PubSub Subscription"

permissions = [
"pubsub.subscriptions.list",
"resourcemanager.projects.get",
]
}

resource "google_project_iam_member" "consumer" {
project = var.project_id
role = google_project_iam_custom_role.consumer.id
member = "serviceAccount:${module.destination.pubsub_subscriber}"
}

resource "google_pubsub_subscription_iam_member" "consumer" {
project = var.project_id
subscription = module.destination.pubsub_subscription
role = "roles/pubsub.subscriber"
member = "serviceAccount:${module.destination.pubsub_subscriber}"
}

0 comments on commit b0b0619

Please sign in to comment.