Skip to content

docs(tofu): close end-to-end gaps so a fresh apply works from the docs - #57

Merged
agjs merged 1 commit into
mainfrom
docs/tofu-provisioning-gaps
May 30, 2026
Merged

docs(tofu): close end-to-end gaps so a fresh apply works from the docs#57
agjs merged 1 commit into
mainfrom
docs/tofu-provisioning-gaps

Conversation

@agjs

@agjs agjs commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes four blocking gaps an operator would hit when following `provisioning-with-tofu.mdx` end-to-end against a fresh Hetzner project, plus two pieces of operator guidance.

Required vars now in `terraform.tfvars.example` — `ghcr_username`, `ghcr_token`, `superuser_email`, `superuser_password`. All were declared in `variables.tf` and wired through `main.tf`, but invisible from the example file.

LinkedIn OAuth wired through tofu. API has a full LinkedIn provider; `apps/api/.env.example` exposes `LINKEDIN_OAUTH_CLIENT_{ID,SECRET}`; `tfvars.example` had commented LinkedIn entries that would emit "undeclared variable" warnings if uncommented. Now follows the same path as Google/GitHub: root variables.tf → bootstrap module variables.tf → main.tf passthrough → compose.env.tftpl.

Wording fixes: `configures Cloudflare DNS firewalls` → `Cloudflare DNS and a Hetzner firewall scoped to Cloudflare's IP ranges`. Sample apply output `5 added` → `9 added` to match the real count.

New troubleshooting callouts:

  • `cloud-init status: done` reports cloud-init's own work, not bootstrap.sh failures inside it. Points operators at `/var/log/cloud-init-output.log` + the right `docker compose` commands.
  • Cloudflare 525 on first apply is expected for 2–5 minutes while DNS propagates and ACME issues. Expanded the entry from "wait or check Traefik logs" to actually-useful guidance (`dig`, `docker compose logs traefik | grep -i acme`).

Bonus: filled an empty description on `github_oauth_client_secret`.

Test plan

  • `tofu fmt && tofu validate` clean in `infra/bootstrap`
  • `apps/docs` builds (67 pages)
  • Diff: 7 files changed, +129/-48
  • Pre-push smoke gate green

A real run against the provisioning-with-tofu doc surfaced four gaps:

1. terraform.tfvars.example was missing slots for ghcr_username,
   ghcr_token, superuser_email, and superuser_password — all declared
   in variables.tf and wired through main.tf, but invisible to an
   operator following the docs.

2. LinkedIn OAuth was half-wired: the API has a full LinkedIn provider
   (apps/api/src/lib/oauth/providers/linkedin.ts) and apps/api/.env.example
   exposes LINKEDIN_OAUTH_CLIENT_{ID,SECRET}, but the tofu side was
   missing — no variable declarations, no module wiring, no template
   rendering. tfvars.example had commented entries that would emit
   "undeclared variable" warnings if uncommented. Wired through the
   same pattern as Google/GitHub (root variables.tf → bootstrap module
   variables.tf → main.tf passthrough → compose.env.tftpl render).

3. PageIntro said "configures Cloudflare DNS firewalls" — reads like
   Cloudflare's paid DNS Firewall product. Tweaked to "Cloudflare DNS
   and a Hetzner firewall scoped to Cloudflare's IP ranges".

4. Sample output claimed "Resources: 5 added" — actual count is 9
   (server, SSH key, firewall, apex A/AAAA, www CNAME, two zone
   settings, redirect ruleset).

Two pieces of operator guidance also added:

- `cloud-init status: done` only means cloud-init's own steps ran —
  it doesn't reflect bootstrap.sh failures inside the script. Added a
  callout pointing at /var/log/cloud-init-output.log + the right
  docker compose commands to find the actual problem.

- "Site returns 525" on first apply is normal for 2–5 minutes while
  DNS propagates and ACME issues the first cert. Expanded the
  troubleshooting entry to set expectations + suggest the dig +
  Traefik log commands operators actually need.

Also fixed a stray empty description on github_oauth_client_secret.

tofu fmt + validate clean. Docs build clean (67 pages).
@agjs
agjs enabled auto-merge (squash) May 30, 2026 09:43
@agjs
agjs disabled auto-merge May 30, 2026 10:10
@agjs
agjs merged commit 3e48e1d into main May 30, 2026
26 checks passed
@agjs
agjs deleted the docs/tofu-provisioning-gaps branch May 30, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant