| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 1 | # infra |
| 2 | |
| 3 | OpenTofu config for the Cloudflare side of the multihost setup in |
| 4 | `blog/hugo.toml`: one Cloudflare Pages project, custom domain, and DNS |
| 5 | record per language (`mykiwi.blog`, `fr.mykiwi.blog`, `pt.mykiwi.blog`, |
| Add Spanish (es) language support 479f7e2 Romain Gautier 9h ago | 6 | `ja.mykiwi.blog`, `es.mykiwi.blog`). It assumes `mykiwi.blog` is already |
| 7 | a zone in your Cloudflare account - this only manages what's *inside* |
| 8 | that zone. |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 9 | |
| 10 | Deploys (`wrangler pages deploy public/<lang> --project-name=...`) are out |
| 11 | of scope here; this just provisions the projects and domains deploys land |
| 12 | on. |
| 13 | |
| 14 | ## Setup |
| 15 | |
| 16 | Create a token at https://dash.cloudflare.com/profile/api-tokens (Custom |
| 17 | Token, scoped to the `mykiwi.blog` zone) with `Zone:DNS:Edit`, |
| Migrate www redirect from Page Rules to Single Redirects b9bda7a Romain Gautier 9h ago | 18 | `Zone:Zone:Read`, `Zone:Dynamic Redirect:Edit`, and |
| 19 | `Account:Cloudflare Pages:Edit`, then: |
| Add Cloudflare provisioning and deploy tooling e4c5d34 Romain Gautier 13h ago | 20 | |
| 21 | ```sh |
| 22 | export CLOUDFLARE_API_TOKEN=... |
| 23 | ``` |
| 24 | |
| 25 | `cloudflare_account_id` is hardcoded in `variables.tf` (it's not a secret - |
| 26 | just an identifier) - override it with `-var` if you're ever applying |
| 27 | against a different account. |
| 28 | |
| 29 | ## Usage |
| 30 | |
| 31 | From the repo root: |
| 32 | |
| 33 | ```sh |
| 34 | make infra-plan |
| 35 | make infra-apply |
| 36 | ``` |
| 37 | |
| 38 | Or directly, from this directory (`nix develop .#infra` for `tofu`): |
| 39 | |
| 40 | ```sh |
| 41 | tofu init |
| 42 | tofu plan |
| 43 | tofu apply |
| 44 | ``` |
| 45 | |
| 46 | State is local (`terraform.tfstate`, gitignored) - fine for a single person |
| 47 | operating this. If that ever changes, move the backend to something shared |
| 48 | (e.g. an R2 bucket) before a second person touches this. |