Skip to content

Commit

Permalink
[Custom DC] add missing IAM for bt automation (#179)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Chen <[email protected]>
  • Loading branch information
Fructokinase and Alex Chen authored Jan 20, 2023
1 parent c472636 commit 3fbd85c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bigtable_automation/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,27 @@ resource "google_cloudfunctions_function" "bt_automation" {
google_storage_bucket_object.bt_automation_archieve
]
}

resource "google_project_iam_member" "bt_automation_iam" {
for_each = toset([
"roles/bigtable.admin",
"roles/dataflow.admin",
"roles/storage.admin",
# Web robot is also used for Cloud Function jobs, which launches Dataflow jobs.
# It needs permission to impersonate Dataflow worker principal.
"roles/iam.serviceAccountUser"
])
role = each.key
member = "serviceAccount:${var.service_account_email}"
project = var.project_id
}

data "google_compute_default_service_account" "default" {
project = var.project_id
}

resource "google_project_iam_member" "dataflow_worker_iam" {
role = "roles/storage.objectAdmin" # For running csv -> BT table jobs.
member = "serviceAccount:${data.google_compute_default_service_account.default.email}"
project = var.project_id
}

0 comments on commit 3fbd85c

Please sign in to comment.