Step 3: Configure
Review the per-environment OpenTofu settings — hostnames, product origins, LiveKit key references and sizes — and change them through a pull request.
Goal: infra/opentofu/platform/environments/staging.tfvars and production.tfvars describe what you want, and the change is merged.
These files hold reviewable, non-secret settings. Account-specific values (Cloudflare IDs, emails, registry, SSH keys, admin IPs) and secrets go into GitHub in step 4, so the repository never contains them.
3.1 What each setting means
| Setting | Meaning |
|---|---|
environment | staging or production |
vpc_ip_range | Private range for this environment's VPC. Must not overlap another VPC in the account (doctl vpcs list) |
api_host … turn_host | Public hostnames, see the domain plan |
scanner_host | Name in the scanner certificate; a DNS-only record to the scanner's private IP |
allowed_origins | Exact https:// origins of product web apps (browser CORS and bucket CORS). The console is added automatically |
webhook_allowed_origins | Origins product webhooks may be delivered to |
livekit_key_refs | One LiveKit key pair is generated per entry. A project environment's LiveKit key reference in the console must match one (for example vibelynk:production) |
media_droplet_size | Media Droplet size, default c-4 (4 dedicated vCPUs, a pilot size) |
Optional settings with defaults are in infra/opentofu/platform/variables.tf: scanner_droplet_size, postgres_size, postgres_version, postgres_pool_size, valkey_size, api_instance_count, api_instance_size, region (sgp1), app_region (sgp). Add any of them to the .tfvars file to override.
3.2 Edit and merge
git switch -c configure-environments
"${EDITOR:-nano}" infra/opentofu/platform/environments/staging.tfvars
"${EDITOR:-nano}" infra/opentofu/platform/environments/production.tfvars
pnpm infra:tofu
git commit -am "infra: configure environments"
git push -u origin configure-environmentsOpen a pull request. Once GitHub is configured (step 4), the Infrastructure workflow posts a tofu plan for staging on pull requests that touch infra/opentofu/.
3.3 Using a different domain
Change every hostname in both .tfvars files, apex and api_hosts in infra/opentofu/zone/variables.tf, and the console's Content Security Policy in apps/admin/public/_headers: its connect-src lists https://api.lynkoria.com and https://api-staging.lynkoria.com, and the browser blocks every other API host.
3.4 Adding a product later
Add its LiveKit reference to livekit_key_refs and its web origin to allowed_origins, merge, and deploy. The media Droplet is replaced when its LiveKit configuration changes (new keys), which ends active calls; deploy that change in a quiet window.
Next: Step 4: GitHub.
Step 2: Bootstrap
The one-time manual setup OpenTofu cannot do for itself — tokens, the state bucket, state passphrases and Cloudflare Zero Trust.
Step 4: GitHub
Create the staging and production environments and give them the secrets and variables the Deploy and Infrastructure workflows pass to OpenTofu.