@@ -4,6 +4,11 @@ resource "google_cloud_run_v2_service" "cal-bc-staging" {
44 deletion_protection = false
55 ingress = " INGRESS_TRAFFIC_ALL"
66
7+ traffic {
8+ type = " TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
9+ percent = 100
10+ }
11+
712 template {
813 service_account = data. terraform_remote_state . iam . outputs . google_service_account_cal-bc-service-account_email
914
@@ -44,12 +49,37 @@ resource "google_cloud_run_v2_service" "cal-bc-staging" {
4449 }
4550 }
4651 }
47- }
48- }
4952
50- traffic {
51- type = " TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
52- percent = 100
53+ env {
54+ name = " AZURE_AUTH__CLIENT_ID"
55+ value_source {
56+ secret_key_ref {
57+ secret = google_secret_manager_secret. cal-bc-staging-azure-auth-client-id . secret_id
58+ version = " latest"
59+ }
60+ }
61+ }
62+
63+ env {
64+ name = " AZURE_AUTH__CLIENT_SECRET"
65+ value_source {
66+ secret_key_ref {
67+ secret = google_secret_manager_secret. cal-bc-staging-azure-auth-client-secret . secret_id
68+ version = " latest"
69+ }
70+ }
71+ }
72+
73+ env {
74+ name = " AZURE_AUTH__DIRECTORY_ID"
75+ value_source {
76+ secret_key_ref {
77+ secret = google_secret_manager_secret. cal-bc-staging-azure-auth-directory-id . secret_id
78+ version = " latest"
79+ }
80+ }
81+ }
82+ }
5383 }
5484}
5585
@@ -59,3 +89,64 @@ resource "google_cloud_run_service_iam_binding" "cal-bc-staging" {
5989 role = " roles/run.invoker"
6090 members = [" allUsers" ]
6191}
92+
93+ resource "google_compute_region_network_endpoint_group" "cal-bc-staging" {
94+ name = " cal-bc-staging"
95+ network_endpoint_type = " SERVERLESS"
96+ region = google_cloud_run_v2_service. cal-bc-staging . location
97+ cloud_run {
98+ service = google_cloud_run_v2_service. cal-bc-staging . name
99+ }
100+ }
101+
102+ resource "google_compute_global_address" "cal-bc-staging" {
103+ name = " cal-bc-staging-address"
104+ }
105+
106+ module "lb-http" {
107+ source = " GoogleCloudPlatform/lb-http/google//modules/serverless_negs"
108+ version = " ~> 13.2"
109+
110+ name = " cal-bc-staging"
111+ project = " cal-itp-data-infra-staging"
112+
113+ ssl = true
114+ managed_ssl_certificate_domains = [" cal-bc-staging.dds.dot.ca.gov" ]
115+ https_redirect = true
116+
117+ address = google_compute_global_address. cal-bc-staging . address
118+ create_address = false
119+
120+ backends = {
121+ default = {
122+ description = null
123+
124+ groups = []
125+ serverless_neg_backends = [
126+ {
127+ " region" : " us-west2" ,
128+ " type" : " cloud-run" ,
129+ " service" : {
130+ " name" : google_cloud_run_v2_service.cal- bc- staging.name
131+ }
132+ }
133+ ]
134+
135+ health_check = {
136+ request_path = " /"
137+ protocol = " HTTP"
138+ port = 80
139+ }
140+
141+ enable_cdn = false
142+
143+ iap_config = {
144+ enable = false
145+ }
146+
147+ log_config = {
148+ enable = false
149+ }
150+ }
151+ }
152+ }
0 commit comments