Skip to content

Commit ee37fe4

Browse files
committed
feat(terraform): manage NEXT_PUBLIC_BACKEND via Terraform
Adds vercel_project_environment_variable.backend_url with value="" to infra/terraform/vercel.tf. The frontend code uses process.env.NEXT_PUBLIC_BACKEND as a prefix for fetch() calls; an empty value forces relative URLs (e.g. /login), which Vercel then rewrites to the backend via vercel.json. Previously documented as a manual Vercel dashboard step; now managed in version control alongside the rest of the env vars. terraform validate: passes.
1 parent 8b3e9cb commit ee37fe4

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

infra/terraform/vercel.tf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ resource "vercel_project_environment_variable" "frontend_url" {
2424
sensitive = false
2525
}
2626

27-
# NOTE: NEXT_PUBLIC_BACKEND is set to "" in the Vercel dashboard
28-
# (Settings → Environment Variables). It's not in this Terraform
29-
# because path-based routing means the frontend uses relative URLs.
30-
# Set it in the dashboard:
31-
# Key: NEXT_PUBLIC_BACKEND
32-
# Value: (empty)
33-
# Target: Production
27+
# Path-based routing: the frontend uses relative URLs (e.g. /login,
28+
# /google_login). Vercel rewrites them to the backend via vercel.json.
29+
# Setting this to "" forces the frontend to use relative paths.
30+
resource "vercel_project_environment_variable" "backend_url" {
31+
project_id = vercel_project.senzen.id
32+
key = "NEXT_PUBLIC_BACKEND"
33+
value = ""
34+
target = ["production"]
35+
sensitive = false
36+
}

0 commit comments

Comments
 (0)