fix(terraform): align Vercel token fallback with default#653
Conversation
📝 WalkthroughWalkthroughThe GitHub Actions Terraform workflow changes the TF_VAR_vercel_api_token fallback from ChangesVercel API Token Fallback
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a015c30 to
980bd20
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/terraform.yml (1)
186-186: ⚡ Quick winCentralize the dummy Vercel token to avoid fallback drift.
This works, but repeating the literal in two places can regress again. Define one workflow-level env constant and reference it in both jobs.
♻️ Suggested change
env: TF_VERSION: "1.14.8" TF_WORKING_DIR: terraform/environments/production + TF_VERCEL_DUMMY_API_TOKEN: "000000000000000000000000" @@ - TF_VAR_vercel_api_token: "${{ secrets.VERCEL_API_TOKEN || '000000000000000000000000' }}" + TF_VAR_vercel_api_token: "${{ secrets.VERCEL_API_TOKEN || env.TF_VERCEL_DUMMY_API_TOKEN }}" @@ - TF_VAR_vercel_api_token: "${{ secrets.VERCEL_API_TOKEN || '000000000000000000000000' }}" + TF_VAR_vercel_api_token: "${{ secrets.VERCEL_API_TOKEN || env.TF_VERCEL_DUMMY_API_TOKEN }}"Also applies to: 317-317
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/terraform.yml at line 186, Centralize the dummy Vercel token by adding a workflow-level environment variable (e.g., VERCEL_DUMMY_TOKEN) and update both usages of TF_VAR_vercel_api_token to reference secrets.VERCEL_API_TOKEN with a fallback to that env var (so TF_VAR_vercel_api_token uses secrets.VERCEL_API_TOKEN || env.VERCEL_DUMMY_TOKEN); update the occurrences that currently use the literal "000000000000000000000000" so they reference VERCEL_DUMMY_TOKEN instead to avoid duplicate literals and future drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/terraform.yml:
- Line 186: Centralize the dummy Vercel token by adding a workflow-level
environment variable (e.g., VERCEL_DUMMY_TOKEN) and update both usages of
TF_VAR_vercel_api_token to reference secrets.VERCEL_API_TOKEN with a fallback to
that env var (so TF_VAR_vercel_api_token uses secrets.VERCEL_API_TOKEN ||
env.VERCEL_DUMMY_TOKEN); update the occurrences that currently use the literal
"000000000000000000000000" so they reference VERCEL_DUMMY_TOKEN instead to avoid
duplicate literals and future drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f57881fa-099f-4370-a05e-f4946dc9d848
📒 Files selected for processing (1)
.github/workflows/terraform.yml
Summary
VERCEL_API_TOKENfallbacks fromunusedto the same 24-character dummy token used by the Terraform variable default.Why
PR #508 updated the Terraform variable default to a 24-character dummy token, but
.github/workflows/terraform.ymlstill overrides that default withunused. Since the Vercel provider validatesapi_tokenduring provider init, Cloudflare-only deployments can still fail in CI even though no Vercel resources are created.This keeps the workflow fallback aligned with the existing Terraform default without changing provider constraints, lockfiles, or deployment behavior for real Vercel tokens.
Prior Upstream Work Checked
upstream/mainstill hadTF_VAR_vercel_api_token: "${{ secrets.VERCEL_API_TOKEN || 'unused' }}"in both the plan and apply jobs before this change.Testing
git diff --checkterraform fmt -check -recursive terraformnpm run lintnpm run typechecknpm test(fails on existingpackages/control-plane/src/utils/models.test.tsGPT 5.5 reasoning default expectations: 2 failed, 1117 passed)terraform -chdir=terraform/environments/production init -backend=false -lockfile=readonly(initializes successfully, with the existing readonly-lockfile warning)terraform -chdir=terraform/environments/production validate -no-color(blocked locally by the existingcloudflare/cloudflare5.19.1 checksum mismatch in.terraform.lock.hclondarwin_arm64; this PR intentionally does not update the lockfile)Summary by CodeRabbit