diff --git a/modules/cloudbuild/README.md b/modules/cloudbuild/README.md index 70979366..dd95f391 100644 --- a/modules/cloudbuild/README.md +++ b/modules/cloudbuild/README.md @@ -61,6 +61,7 @@ Functional examples and sample Cloud Build definitions are included in the [exam | folder\_id | The ID of a folder to host this project | `string` | `""` | no | | gar\_repo\_name | Custom name to use for GAR repo. | `string` | `""` | no | | group\_org\_admins | Google Group for GCP Organization Administrators | `string` | n/a | yes | +| impersonate\_service\_account | The service account to impersonate while running the gcloud builds submit command. | `string` | `""` | no | | org\_id | GCP Organization ID | `string` | n/a | yes | | project\_id | Custom project ID to use for project created. | `string` | `""` | no | | project\_labels | Labels to apply to the project. | `map(string)` | `{}` | no | diff --git a/modules/cloudbuild/main.tf b/modules/cloudbuild/main.tf index c92b9faa..e5c853ed 100644 --- a/modules/cloudbuild/main.tf +++ b/modules/cloudbuild/main.tf @@ -22,6 +22,7 @@ locals { activate_apis = distinct(concat(var.activate_apis, local.cloudbuild_apis)) apply_branches_regex = "^(${join("|", var.terraform_apply_branches)})$" gar_name = split("/", google_artifact_registry_repository.tf-image-repo.name)[length(split("/", google_artifact_registry_repository.tf-image-repo.name)) - 1] + impersonate_service_account = var.impersonate_service_account != "" ? "--impersonate-service-account=${var.impersonate_service_account}" : "" } resource "random_id" "suffix" { @@ -193,7 +194,7 @@ resource "null_resource" "cloudbuild_terraform_builder" { provisioner "local-exec" { command = <