File tree 3 files changed +28
-1
lines changed
3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Cloud Build Pipeline for gcp-python-fastapi
2
2
# https://github.com/The-DevSec-Blueprint/gcp-python-fastapi/tree/main
3
+ resource "google_service_account" "cloudbuild_service_account" {
4
+ account_id = " ${ var . cloudbuild_trigger_name } -sa"
5
+ display_name = " ${ var . cloudbuild_trigger_name } -sa"
6
+ description = " Cloud Build Service Account for ${ var . cloudbuild_trigger_name } "
7
+ }
8
+
9
+ resource "google_project_iam_member" "act_as" {
10
+ project = var. project_id
11
+ role = " roles/iam.serviceAccountUser"
12
+ member = " serviceAccount:${ google_service_account . cloudbuild_service_account . email } "
13
+ }
14
+
15
+ resource "google_project_iam_member" "logs_writer" {
16
+ project = var. project_id
17
+ role = " roles/logging.logWriter"
18
+ member = " serviceAccount:${ google_service_account . cloudbuild_service_account . email } "
19
+ }
20
+
3
21
resource "google_cloudbuild_trigger" "build_trigger" {
4
22
name = var. cloudbuild_trigger_name
5
23
description = var. description
6
24
filename = var. filename
7
25
26
+ service_account = google_service_account. cloudbuild_service_account . id
27
+
8
28
github {
9
29
owner = " The-DevSec-Blueprint"
10
30
name = var. github_repo_name
Original file line number Diff line number Diff line change @@ -17,4 +17,9 @@ variable "filename" {
17
17
variable "github_repo_name" {
18
18
description = " Name of the GitHub repository"
19
19
type = string
20
+ }
21
+
22
+ variable "project_id" {
23
+ description = " ID of the Google Cloud project"
24
+ type = string
20
25
}
Original file line number Diff line number Diff line change 1
1
module "gcp_python_fastapi_pipeline" {
2
- source = " ./modules/pipelines"
2
+ source = " ./modules/pipelines"
3
+
4
+ project_id = var. project_id
3
5
cloudbuild_trigger_name = " gcp-python-fastapi"
4
6
description = " Cloud Build Trigger for GCP Python FastAPI"
5
7
github_repo_name = " gcp-python-fastapi"
You can’t perform that action at this time.
0 commit comments