Skip to content

Commit

Permalink
Merge pull request #6 from rjerrems/fix-impersonation
Browse files Browse the repository at this point in the history
Fix permissions issue in #5 for org admins using impersonation
  • Loading branch information
morgante authored Dec 18, 2019
2 parents 3e7a2f6 + bdf1e95 commit 85984a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,11 @@ resource "google_organization_iam_member" "org_admin_serviceusage_consumer" {
role = "roles/serviceusage.serviceUsageConsumer"
member = "group:${var.group_org_admins}"
}

resource "google_storage_bucket_iam_member" "orgadmins_state_iam" {
count = local.impersonation_enabled_count

bucket = google_storage_bucket.org_terraform_state.name
role = "roles/storage.admin"
member = "group:${var.group_org_admins}"
}
1 change: 1 addition & 0 deletions test/integration/cloudbuild_enabled/controls/gcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
google_projects.where(project_id: attribute("cloudbuild_project_id")).project_numbers.each do |project_number|
describe google_storage_bucket_iam_binding(bucket: attribute("gcs_bucket_tfstate"), role: 'roles/storage.admin') do
it { should exist }
its('members') {should include 'group:' + attribute("group_org_admins")}
its('members') {should include 'serviceAccount:' + attribute("terraform_sa_email")}
its('members') {should include 'serviceAccount:' + project_number.to_s + '@cloudbuild.gserviceaccount.com'}
end
Expand Down

0 comments on commit 85984a9

Please sign in to comment.