Created
October 15, 2024 15:51
-
-
Save kborovik/5f9339e4dc55e6d34090d891ceaadba7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# Google Project IAM Members | |
# Single stanza for all IAM bindings | |
############################################################################### | |
locals { | |
google_project = "example-project" | |
users = toset([ | |
"user:[email protected]", | |
"user:[email protected]", | |
"user:[email protected]", | |
]) | |
users_roles = toset([ | |
"roles/viewer", | |
"roles/bigquery.admin", | |
"roles/run.admin", | |
"roles/run.invoker", | |
"roles/compute.osAdminLogin", | |
"roles/iap.tunnelResourceAccessor", | |
"roles/compute.instanceAdmin.v1", | |
]) | |
} | |
resource "google_project_iam_member" "users" { | |
for_each = { | |
for pair in setproduct(local.users, local.users_roles) : | |
"${pair[0]}-${pair[1]}" => { | |
member = pair[0] | |
role = pair[1] | |
} | |
} | |
project = local.google_project | |
member = each.value.member | |
role = each.value.role | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment