Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: grant membership to bootstrap terraform SA to access required groups #1301

Closed
wants to merge 8 commits into from
21 changes: 21 additions & 0 deletions 0-bootstrap/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,24 @@ module "seed_bootstrap" {
depends_on = [module.required_group]
}

# Fix for Issue #1206 with Groups vs. Terraform SA vs. Owner
resource "google_cloud_identity_group_membership" "required_group_sa" {
# works only with google-beta
provider = google-beta
depends_on = [module.seed_bootstrap, google_service_account.terraform-env-sa, module.required_group]
for_each = local.required_groups_to_create
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran through this in my local setup, seems to address the permission problem identified in 1206, because we explicitly add the bootstrap SA as group owner.

However, this code is just addressing the required groups block, can you extend the logic to also address the optional groups block?

group = module.required_group[each.key].resource_name

preferred_member_key {
id = google_service_account.terraform-env-sa["bootstrap"].email
}

roles {
name = "MEMBER"
}

roles {
name = "OWNER"
}

}