Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Allow service account to launch Dataflow job #1450

Merged
merged 2 commits into from
Sep 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ resource "google_cloud_scheduler_job" "scheduler" {
"environment": {
"maxWorkers": "10",
"tempLocation": "gs://${var.bucket}/temp",
"zone": "${var.region}-a"
"zone": "${var.region}-a",
"serviceAccountEmail": "${google_service_account.cloud-scheduler-demo.email}"
}
}
EOT
Expand All @@ -45,15 +46,15 @@ resource "google_service_account" "cloud-scheduler-demo" {
display_name = "A service account for running dataflow from cloud scheduler"
}

resource "google_project_iam_member" "cloud-scheduler-dataflow" {
resource "google_project_iam_member" "cloud-scheduler-dataflow-admin" {
project = var.project_id
role = "roles/dataflow.admin"
member = "serviceAccount:${google_service_account.cloud-scheduler-demo.email}"
}

resource "google_project_iam_member" "cloud-scheduler-gcs" {
resource "google_project_iam_member" "cloud-scheduler-dataflow-worker" {
project = var.project_id
role = "roles/compute.storageAdmin"
role = "roles/dataflow.worker"
member = "serviceAccount:${google_service_account.cloud-scheduler-demo.email}"
}