File tree Expand file tree Collapse file tree
modules/gcp/gcs-iap-proxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ resource "google_service_account" "proxy_sa" {
1717
1818# Grant storage access to the service account
1919resource "google_storage_bucket_iam_member" "proxy_storage_access" {
20+ count = var. bucket_name != " " ? 1 : 0
2021 bucket = var. bucket_name
2122 role = " roles/storage.objectViewer"
2223 member = " serviceAccount:${ google_service_account . proxy_sa . email } "
@@ -36,9 +37,12 @@ resource "google_cloud_run_v2_service" "gcs_proxy" {
3637 image = var. proxy_image
3738
3839 # Core environment variables
39- env {
40- name = " GCS_BUCKET"
41- value = var. bucket_name
40+ dynamic "env" {
41+ for_each = var. bucket_name != " " ? [1 ] : []
42+ content {
43+ name = " GCS_BUCKET"
44+ value = var. bucket_name
45+ }
4246 }
4347
4448 # SPA configuration
@@ -105,6 +109,11 @@ resource "google_cloud_run_v2_service" "gcs_proxy" {
105109 # Configure ingress to only allow load balancer traffic
106110 ingress = " INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER"
107111
112+ traffic {
113+ type = " TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
114+ percent = 100
115+ }
116+
108117 labels = local. labels
109118
110119 depends_on = [
Original file line number Diff line number Diff line change @@ -4,8 +4,9 @@ variable "namespace" {
44}
55
66variable "bucket_name" {
7- description = " The name of the GCS bucket to serve files from"
7+ description = " The name of the GCS bucket to serve files from (optional) "
88 type = string
9+ default = " "
910}
1011
1112variable "region" {
@@ -34,6 +35,7 @@ variable "iap_users" {
3435variable "support_email" {
3536 description = " Support email for IAP OAuth consent screen"
3637 type = string
38+ default = " "
3739}
3840
3941variable "application_title" {
You can’t perform that action at this time.
0 commit comments