File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ module "gcp_python_fastapi_pipeline" {
4747 cloudbuild_trigger_name = " gcp-python-fastapi"
4848 description = " Cloud Build Trigger for GCP Python FastAPI"
4949 github_repo_name = " gcp-python-fastapi"
50+ secret_id = google_secret_manager_secret. snyk_token . id
5051
5152 depends_on = [
5253 google_artifact_registry_repository . default ,
Original file line number Diff line number Diff line change @@ -14,14 +14,20 @@ resource "google_project_iam_member" "cloud_build_roles" {
1414 " roles/storage.admin" ,
1515 " roles/logging.logWriter" ,
1616 " roles/iam.serviceAccountUser" ,
17- " roles/secretmanager.admin" ,
18- " roles/secretmanager.secretAssessor"
17+ " roles/secretmanager.admin"
1918 ])
2019 project = var. project_id
2120 role = each. value
2221 member = " serviceAccount:${ google_service_account . cloudbuild_service_account . email } "
2322}
2423
24+ resource "google_secret_manager_secret_iam_member" "secret_manager_binding" {
25+ project = var. project_id
26+ secret_id = var. secret_id
27+ role = " roles/secretmanager.secretAccessor"
28+ member = " serviceAccount:${ google_service_account . cloudbuild_service_account . email } "
29+ }
30+
2531resource "google_cloudbuild_trigger" "build_trigger" {
2632 name = " gh-trigger-${ var . cloudbuild_trigger_name } "
2733 description = var. description
Original file line number Diff line number Diff line change @@ -27,4 +27,9 @@ variable "project_id" {
2727variable "region" {
2828 description = " Region where the Cloud Build trigger will be created"
2929 type = string
30+ }
31+
32+ variable "secret_id" {
33+ description = " ID of the secret to be injected into the Cloud Build"
34+ type = string
3035}
You can’t perform that action at this time.
0 commit comments