Skip to content

Commit ae12bdc

Browse files
authored
[CI] Use iam_member instead of iam_binding for BQ JobUser role (#562)
This change makes it so the `bigquery.jobUser` role can be granted to new members while preserving grants for past members. `google_project_iam_binding` is authoritative, and revokes role access for all other members who are not listed in the resource definition when running `terraform apply`. This is problematic as we now have another internal service account that needs access to `role/bigquery.jobUser`, and it's membership will continue to be revoked as long as we define a binding here.
1 parent a3d772e commit ae12bdc

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

premerge/main.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,10 @@ resource "google_service_account" "operational_metrics_gsa" {
262262
display_name = "Operational Metrics GSA"
263263
}
264264

265-
resource "google_project_iam_binding" "bigquery_jobuser_binding" {
265+
resource "google_project_iam_member" "operational_metrics_gsa_bq_jobuser_member" {
266266
project = google_service_account.operational_metrics_gsa.project
267267
role = "roles/bigquery.jobUser"
268-
269-
members = [
270-
"serviceAccount:${google_service_account.operational_metrics_gsa.email}",
271-
]
268+
member = "serviceAccount:${google_service_account.operational_metrics_gsa.email}"
272269

273270
depends_on = [google_service_account.operational_metrics_gsa]
274271
}

0 commit comments

Comments
 (0)