Skip to content

Commit da1c0bf

Browse files
committed
Support conformance env lifecycle in GCP CI Cloud Build
1 parent 461d38a commit da1c0bf

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

deployment/modules/gcp/cloudrun/iam/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "google_service_account" "cloudrun_service_account" {
2-
account_id = "cloudrun-${var.env}-sa"
2+
account_id = var.cloudrun_service_account_id
33
display_name = "Service Account for Cloud Run (${var.env})"
44
}
55

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "cloudrun_service_account" {
2+
description = "The Cloud Run service account"
3+
value = google_service_account.cloudrun_service_account
4+
}

deployment/modules/gcp/cloudrun/iam/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ variable "env" {
88
type = string
99
}
1010

11+
variable "cloudrun_service_account_id" {
12+
description = "The Clour Run service account ID to be created"
13+
type = string
14+
}
15+
1116
variable "bucket" {
1217
description = "Log GCS bucket"
1318
type = string

deployment/modules/gcp/cloudrun/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ module "cloudrun_iam" {
2626
}
2727

2828
locals {
29+
cloudrun_service_account_id = "cloudrun-${var.env}-sa"
2930
spanner_log_db_path = "projects/${var.project_id}/instances/${var.log_spanner_instance}/databases/${var.log_spanner_db}"
3031
spanner_dedup_db_path = "projects/${var.project_id}/instances/${var.log_spanner_instance}/databases/${var.dedup_spanner_db}"
3132
}
@@ -36,7 +37,7 @@ resource "google_cloud_run_v2_service" "default" {
3637
launch_stage = "GA"
3738

3839
template {
39-
service_account = google_service_account.cloudrun_service_account.account_id
40+
service_account = module.cloudrun_iam.cloudrun_service_account.account_id
4041
max_instance_request_concurrency = 700
4142
timeout = "5s"
4243

0 commit comments

Comments
 (0)