Fix HCL syntax errors in accounts and api Cloud Run definitions

This commit is contained in:
Will Anderson
2026-04-25 22:50:22 -05:00
parent d4c65d5857
commit bb583e3ccb
2 changed files with 282 additions and 87 deletions
+122 -40
View File
@@ -1,8 +1,7 @@
# ── REST API (neuron-rest) — Cloud Run ────────────────────────────────────────
# Stateless API layer. Validates JWTs issued by the accounts service.
# Does NOT connect to Cloud SQL directly — reads from accounts service for
# user context; maintains its own in-process state only.
# No Cloud SQL volume needed here.
# Stateless API layer. Validates JWTs from accounts service.
# No database connection — reads user context from accounts service.
# cpu_idle=false: always-hot, no cold-start latency for API calls.
locals {
api_labels = {
@@ -36,13 +35,22 @@ resource "google_cloud_run_v2_service" "api_us" {
cpu = "2"
memory = "1Gi"
}
cpu_idle = false # API needs to be always-hot; no cold starts
cpu_idle = false
}
env { name = "ENV"; value = "production" }
env { name = "PORT"; value = "8080" }
env {
name = "ENV"
value = "production"
}
env {
name = "PORT"
value = "8080"
}
env {
name = "ACCOUNTS_SERVICE_URL"
value = "https://accounts.neurontechnologies.ai"
}
# JWT key — shared with accounts service for token validation
env {
name = "JWT_SECRET"
value_source {
@@ -52,8 +60,6 @@ resource "google_cloud_run_v2_service" "api_us" {
}
}
}
# License admin token — for neuron-mcp license checks
env {
name = "LICENSE_ADMIN_TOKEN"
value_source {
@@ -64,12 +70,6 @@ resource "google_cloud_run_v2_service" "api_us" {
}
}
# Accounts service URL — for JWT validation and user lookups
env {
name = "ACCOUNTS_SERVICE_URL"
value = "https://accounts.neurontechnologies.ai"
}
ports {
container_port = 8080
name = "http1"
@@ -132,39 +132,80 @@ resource "google_cloud_run_v2_service" "api_eu" {
image = local.api_image
resources {
limits = { cpu = "2"; memory = "1Gi" }
limits = {
cpu = "2"
memory = "1Gi"
}
cpu_idle = false
}
env { name = "ENV"; value = "production" }
env { name = "PORT"; value = "8080" }
env {
name = "ENV"
value = "production"
}
env {
name = "PORT"
value = "8080"
}
env {
name = "ACCOUNTS_SERVICE_URL"
value = "https://accounts.neurontechnologies.ai"
}
env {
name = "JWT_SECRET"
value_source { secret_key_ref { secret = google_secret_manager_secret.jwt_secret.secret_id; version = "latest" } }
value_source {
secret_key_ref {
secret = google_secret_manager_secret.jwt_secret.secret_id
version = "latest"
}
}
}
env {
name = "LICENSE_ADMIN_TOKEN"
value_source { secret_key_ref { secret = google_secret_manager_secret.license_admin_token.secret_id; version = "latest" } }
value_source {
secret_key_ref {
secret = google_secret_manager_secret.license_admin_token.secret_id
version = "latest"
}
}
}
env { name = "ACCOUNTS_SERVICE_URL"; value = "https://accounts.neurontechnologies.ai" }
ports { container_port = 8080; name = "http1" }
ports {
container_port = 8080
name = "http1"
}
startup_probe {
http_get { path = "/health"; port = 8080 }
initial_delay_seconds = 2; timeout_seconds = 5; period_seconds = 5; failure_threshold = 6
http_get {
path = "/health"
port = 8080
}
initial_delay_seconds = 2
timeout_seconds = 5
period_seconds = 5
failure_threshold = 6
}
liveness_probe {
http_get { path = "/health"; port = 8080 }
timeout_seconds = 5; period_seconds = 30; failure_threshold = 3
http_get {
path = "/health"
port = 8080
}
timeout_seconds = 5
period_seconds = 30
failure_threshold = 3
}
}
max_instance_request_concurrency = 1000
}
traffic { type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"; percent = 100 }
traffic {
type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
percent = 100
}
depends_on = [google_project_iam_member.api_secret_accessor]
}
@@ -189,38 +230,79 @@ resource "google_cloud_run_v2_service" "api_apac" {
image = local.api_image
resources {
limits = { cpu = "2"; memory = "1Gi" }
limits = {
cpu = "2"
memory = "1Gi"
}
cpu_idle = false
}
env { name = "ENV"; value = "production" }
env { name = "PORT"; value = "8080" }
env {
name = "ENV"
value = "production"
}
env {
name = "PORT"
value = "8080"
}
env {
name = "ACCOUNTS_SERVICE_URL"
value = "https://accounts.neurontechnologies.ai"
}
env {
name = "JWT_SECRET"
value_source { secret_key_ref { secret = google_secret_manager_secret.jwt_secret.secret_id; version = "latest" } }
value_source {
secret_key_ref {
secret = google_secret_manager_secret.jwt_secret.secret_id
version = "latest"
}
}
}
env {
name = "LICENSE_ADMIN_TOKEN"
value_source { secret_key_ref { secret = google_secret_manager_secret.license_admin_token.secret_id; version = "latest" } }
value_source {
secret_key_ref {
secret = google_secret_manager_secret.license_admin_token.secret_id
version = "latest"
}
}
}
env { name = "ACCOUNTS_SERVICE_URL"; value = "https://accounts.neurontechnologies.ai" }
ports { container_port = 8080; name = "http1" }
ports {
container_port = 8080
name = "http1"
}
startup_probe {
http_get { path = "/health"; port = 8080 }
initial_delay_seconds = 2; timeout_seconds = 5; period_seconds = 5; failure_threshold = 6
http_get {
path = "/health"
port = 8080
}
initial_delay_seconds = 2
timeout_seconds = 5
period_seconds = 5
failure_threshold = 6
}
liveness_probe {
http_get { path = "/health"; port = 8080 }
timeout_seconds = 5; period_seconds = 30; failure_threshold = 3
http_get {
path = "/health"
port = 8080
}
timeout_seconds = 5
period_seconds = 30
failure_threshold = 3
}
}
max_instance_request_concurrency = 1000
}
traffic { type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"; percent = 100 }
traffic {
type = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
percent = 100
}
depends_on = [google_project_iam_member.api_secret_accessor]
}