-
Notifications
You must be signed in to change notification settings - Fork 144
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
feat!: Use user defined SA for cb triggers #148
feat!: Use user defined SA for cb triggers #148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @amandakarina
Can we also remove this since TF SA will be used and not CB SA?
terraform-google-bootstrap/modules/cloudbuild/main.tf
Lines 226 to 249 in 953241e
resource "google_service_account_iam_member" "cloudbuild_terraform_sa_impersonate_permissions" { | |
count = local.impersonation_enabled_count | |
service_account_id = var.terraform_sa_name | |
role = "roles/iam.serviceAccountTokenCreator" | |
member = "serviceAccount:${module.cloudbuild_project.project_number}@cloudbuild.gserviceaccount.com" | |
} | |
resource "google_organization_iam_member" "cloudbuild_serviceusage_consumer" { | |
count = local.impersonation_enabled_count | |
org_id = var.org_id | |
role = "roles/serviceusage.serviceUsageConsumer" | |
member = "serviceAccount:${module.cloudbuild_project.project_number}@cloudbuild.gserviceaccount.com" | |
} | |
# Required to allow cloud build to access state with impersonation. | |
resource "google_storage_bucket_iam_member" "cloudbuild_state_iam" { | |
count = local.impersonation_enabled_count | |
bucket = var.terraform_state_bucket | |
role = "roles/storage.admin" | |
member = "serviceAccount:${module.cloudbuild_project.project_number}@cloudbuild.gserviceaccount.com" | |
} |
We should also update the docs on new IAM permissions needed.
Marking as breaking since existing workflows leveraging TF SA impersonation will need updates. |
Code review suggestions Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
Cloud build, currently, does not support using a service account from another project. |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This should be unblocked now https://cloud.google.com/build/docs/securing-builds/configure-user-specified-service-accounts#cross-project_set_up |
Hi @bharathkkb I will test it |
it is necessary to add logsBucket: 'gs://$_LOGS_BUCKET_NAME' at the end of cloud build files to use the logging bucket |
@amandakarina |
Hey folks,
This pull request adds the user-defines service account in cloud build trigger.
This pull request is a requirements for terraform-google-modules/terraform-example-foundation#546