mykiwi/mykiwi.blogpublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/mykiwi/mykiwi.blog.git
git clone ssh://git@rickub.com/mykiwi/mykiwi.blog.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

README.md · 48 lines · 1.3 KBmarkdown
Blame HistoryOpen raw

infra

OpenTofu config for the Cloudflare side of the multihost setup in
blog/hugo.toml: one Cloudflare Pages project, custom domain, and DNS
record per language (mykiwi.blog, fr.mykiwi.blog, pt.mykiwi.blog,
ja.mykiwi.blog, es.mykiwi.blog). It assumes mykiwi.blog is already
a zone in your Cloudflare account - this only manages what's inside
that zone.

Deploys (wrangler pages deploy public/<lang> --project-name=...) are out
of scope here; this just provisions the projects and domains deploys land
on.

Setup

Create a token at https://dash.cloudflare.com/profile/api-tokens (Custom
Token, scoped to the mykiwi.blog zone) with Zone:DNS:Edit,
Zone:Zone:Read, Zone:Dynamic Redirect:Edit, and
Account:Cloudflare Pages:Edit, then:

export CLOUDFLARE_API_TOKEN=...

cloudflare_account_id is hardcoded in variables.tf (it's not a secret -
just an identifier) - override it with -var if you're ever applying
against a different account.

Usage

From the repo root:

make infra-plan
make infra-apply

Or directly, from this directory (nix develop .#infra for tofu):

tofu init
tofu plan
tofu apply

State is local (terraform.tfstate, gitignored) - fine for a single person
operating this. If that ever changes, move the backend to something shared
(e.g. an R2 bucket) before a second person touches this.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# infra

OpenTofu config for the Cloudflare side of the multihost setup in
`blog/hugo.toml`: one Cloudflare Pages project, custom domain, and DNS
record per language (`mykiwi.blog`, `fr.mykiwi.blog`, `pt.mykiwi.blog`,
`ja.mykiwi.blog`, `es.mykiwi.blog`). It assumes `mykiwi.blog` is already
a zone in your Cloudflare account - this only manages what's *inside*
that zone.

Deploys (`wrangler pages deploy public/<lang> --project-name=...`) are out
of scope here; this just provisions the projects and domains deploys land
on.

## Setup

Create a token at https://dash.cloudflare.com/profile/api-tokens (Custom
Token, scoped to the `mykiwi.blog` zone) with `Zone:DNS:Edit`,
`Zone:Zone:Read`, `Zone:Dynamic Redirect:Edit`, and
`Account:Cloudflare Pages:Edit`, then:

```sh
export CLOUDFLARE_API_TOKEN=...
```

`cloudflare_account_id` is hardcoded in `variables.tf` (it's not a secret -
just an identifier) - override it with `-var` if you're ever applying
against a different account.

## Usage

From the repo root:

```sh
make infra-plan
make infra-apply
```

Or directly, from this directory (`nix develop .#infra` for `tofu`):

```sh
tofu init
tofu plan
tofu apply
```

State is local (`terraform.tfstate`, gitignored) - fine for a single person
operating this. If that ever changes, move the backend to something shared
(e.g. an R2 bucket) before a second person touches this.