File tree Expand file tree Collapse file tree 7 files changed +35
-15
lines changed
Expand file tree Collapse file tree 7 files changed +35
-15
lines changed Original file line number Diff line number Diff line change @@ -232,8 +232,8 @@ module "cloud_run" {
232232 resend_api_key_id = module. secrets . resend_api_key_id
233233 gemini_api_key_id = module. secrets . gemini_api_key_id
234234
235- parallax_api_key_id = module. secrets . parallax_api_key_id
236- parallax_control_plane_url = var . parallax_control_plane_url
235+ parallax_api_key_id = module. secrets . parallax_api_key_id
236+ parallax_control_plane_url_id = module . secrets . parallax_control_plane_url_id
237237
238238 # Storage service account for GCS access
239239 storage_bucket_name = module. cloud_storage . bucket_name
Original file line number Diff line number Diff line change @@ -74,6 +74,14 @@ resource "google_secret_manager_secret_iam_member" "parallax_api_key" {
7474 member = " serviceAccount:${ google_service_account . cloud_run . email } "
7575}
7676
77+ resource "google_secret_manager_secret_iam_member" "parallax_control_plane_url" {
78+ count = var. parallax_control_plane_url_id != " " ? 1 : 0
79+ project = var. project_id
80+ secret_id = var. parallax_control_plane_url_id
81+ role = " roles/secretmanager.secretAccessor"
82+ member = " serviceAccount:${ google_service_account . cloud_run . email } "
83+ }
84+
7785# Grant Cloud SQL Client access
7886resource "google_project_iam_member" "cloud_sql_client" {
7987 project = var. project_id
@@ -320,12 +328,17 @@ resource "google_cloud_run_v2_service" "main" {
320328 }
321329 }
322330
323- # Plain env : PARALLAX_CONTROL_PLANE_URL (not sensitive )
331+ # Secret : PARALLAX_CONTROL_PLANE_URL (stored as secret to avoid exposing infra )
324332 dynamic "env" {
325- for_each = var. parallax_control_plane_url != " " ? [1 ] : []
333+ for_each = var. parallax_control_plane_url_id != " " ? [1 ] : []
326334 content {
327- name = " PARALLAX_CONTROL_PLANE_URL"
328- value = var. parallax_control_plane_url
335+ name = " PARALLAX_CONTROL_PLANE_URL"
336+ value_source {
337+ secret_key_ref {
338+ secret = var. parallax_control_plane_url_id
339+ version = " latest"
340+ }
341+ }
329342 }
330343 }
331344
Original file line number Diff line number Diff line change @@ -147,8 +147,8 @@ variable "parallax_api_key_id" {
147147 default = " "
148148}
149149
150- variable "parallax_control_plane_url " {
151- description = " Parallax control plane HTTP URL (e.g. http://34.58.31.212:8080) "
150+ variable "parallax_control_plane_url_id " {
151+ description = " Secret Manager secret ID for PARALLAX_CONTROL_PLANE_URL "
152152 type = string
153153 default = " "
154154}
Original file line number Diff line number Diff line change @@ -64,3 +64,10 @@ data "google_secret_manager_secret" "parallax_api_key" {
6464 secret_id = " ${ var . resource_prefix } -parallax-api-key"
6565 project = var. project_id
6666}
67+
68+ # Parallax Control Plane URL (optional - stored as secret to avoid exposing infra)
69+ data "google_secret_manager_secret" "parallax_control_plane_url" {
70+ count = var. enable_parallax ? 1 : 0
71+ secret_id = " ${ var . resource_prefix } -parallax-control-plane-url"
72+ project = var. project_id
73+ }
Original file line number Diff line number Diff line change @@ -43,3 +43,8 @@ output "parallax_api_key_id" {
4343 description = " Parallax API key secret resource ID"
4444 value = var. enable_parallax ? data. google_secret_manager_secret . parallax_api_key [0 ]. id : " "
4545}
46+
47+ output "parallax_control_plane_url_id" {
48+ description = " Parallax control plane URL secret resource ID"
49+ value = var. enable_parallax ? data. google_secret_manager_secret . parallax_control_plane_url [0 ]. id : " "
50+ }
Original file line number Diff line number Diff line change @@ -108,5 +108,5 @@ db_password = ""
108108# Set to true once the parallax-api-key secret exists in Secret Manager
109109# parallax_enabled = true
110110
111- # Parallax control plane HTTP URL (not a secret — plain env var)
112- # parallax_control_plane_url = "http://34.58.31.212:8080"
111+ # Both PARALLAX_API_KEY and PARALLAX_CONTROL_PLANE_URL are stored as secrets
112+ # in GCP Secret Manager (not in this file) to avoid exposing infra details.
Original file line number Diff line number Diff line change @@ -212,8 +212,3 @@ variable "parallax_enabled" {
212212 default = false
213213}
214214
215- variable "parallax_control_plane_url" {
216- description = " Parallax control plane HTTP URL (e.g. http://34.58.31.212:8080)"
217- type = string
218- default = " "
219- }
You can’t perform that action at this time.
0 commit comments