Codifying scotthavird.com in Terraform
For years this site lived in two places at once: the Docusaurus repo and a scattering of Cloudflare dashboard clicks. Pages project settings, custom domains, zone security toggles, and an email signup API that only existed in AWS β none of it was reviewable in a PR.
That drift is fine until it isn't. I hit the www redirect trap on my own domain. Preview builds failed because Node 18 was still configured in the dashboard while Docusaurus 3.9 requires Node 20. Each fix was another manual change with no audit trail.
So I codified the whole stack in iac/ and retired the GitHub Actions deploy workflow in favor of native Cloudflare Pages builds.
What Moved Into Terraform
The iac/ directory now owns four concerns that used to be split across dashboards:
Concern Resource Why codify it
Site hosting cloudflare_pages_project Build command, Node version, preview branch rules
Zone security null_resource + Cloudflare API SSL strict, HSTS preload, TLS 1.3
Email signup APIβ¦