File tree 3 files changed +14
-2
lines changed
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" {
47
47
cloudbuild_trigger_name = " gcp-python-fastapi"
48
48
description = " Cloud Build Trigger for GCP Python FastAPI"
49
49
github_repo_name = " gcp-python-fastapi"
50
+ secret_id = google_secret_manager_secret. snyk_token . id
50
51
51
52
depends_on = [
52
53
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" {
14
14
" roles/storage.admin" ,
15
15
" roles/logging.logWriter" ,
16
16
" roles/iam.serviceAccountUser" ,
17
- " roles/secretmanager.admin" ,
18
- " roles/secretmanager.secretAssessor"
17
+ " roles/secretmanager.admin"
19
18
])
20
19
project = var. project_id
21
20
role = each. value
22
21
member = " serviceAccount:${ google_service_account . cloudbuild_service_account . email } "
23
22
}
24
23
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
+
25
31
resource "google_cloudbuild_trigger" "build_trigger" {
26
32
name = " gh-trigger-${ var . cloudbuild_trigger_name } "
27
33
description = var. description
Original file line number Diff line number Diff line change @@ -27,4 +27,9 @@ variable "project_id" {
27
27
variable "region" {
28
28
description = " Region where the Cloud Build trigger will be created"
29
29
type = string
30
+ }
31
+
32
+ variable "secret_id" {
33
+ description = " ID of the secret to be injected into the Cloud Build"
34
+ type = string
30
35
}
You can’t perform that action at this time.
0 commit comments