Skip to content

Commit

Permalink
add cloud build service agent fix for modules that create projects
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-cit committed Oct 30, 2024
1 parent b4f99a1 commit 685b59b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/cloudbuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@ resource "time_sleep" "impersonate_propagation" {
]
}

/******************************************
Cloudbuild Service Agent Role
******************************************/

resource "google_project_iam_member" "cb_service_agent_role" {
project = module.cloudbuild_project.project_id
role = "roles/cloudbuild.serviceAgent"
member = "serviceAccount:service-${module.cloudbuild_project.project_number}@gcp-sa-cloudbuild.iam.gserviceaccount.com"
}

/******************************************
Cloudbuild IAM for admins
*******************************************/
Expand Down
8 changes: 8 additions & 0 deletions modules/tf_cloudbuild_source/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ resource "google_project_iam_member" "org_admins_source_repo_admin" {
member = "group:${var.group_org_admins}"
}

//Cloudbuild Service Agent
resource "google_project_iam_member" "cb_service_agent_role" {
project = module.cloudbuild_project.project_id
role = "roles/cloudbuild.serviceAgent"
member = "serviceAccount:service-${module.cloudbuild_project.project_number}@gcp-sa-cloudbuild.iam.gserviceaccount.com"
}

//Cloudbuild Service Account
resource "google_storage_bucket_iam_member" "cloudbuild_iam" {
bucket = module.cloudbuild_bucket.bucket.name
role = "roles/storage.admin"
Expand Down

0 comments on commit 685b59b

Please sign in to comment.