You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB
Markdown

+++
title = "Define Cloudflare D1 database resource and document binding name for the Worker"
priority = 7
status = "todo"
ticket_type = "task"
dependencies = ["25c413", "2d1371", "5c0c64"]
+++
<context>
Infrastructure is managed with OpenTofu using the Cloudflare provider. Configuration lives in `infra/`. Resources include a Cloudflare Worker (API), Cloudflare D1 database (bound to the worker), and a Cloudflare Pages project (UI frontend).
Cloudflare D1 is the production SQLite-compatible database. It must be provisioned before the Worker can bind to it.
</context>
<goal>
Define the Cloudflare D1 database resource in `infra/d1.tf`:
1. `cloudflare_d1_database` resource for the `quotesdb` database
2. Output the D1 database ID so it can be referenced in the Worker binding
3. Document the binding name (e.g. `DB`) that the Worker expects — this must match the workers-rs binding name in the API code
Every block must have a comment.
</goal>
<constraints>
- Resolve TRIAGE ticket 5c0c64 (D1 migrations in OpenTofu) for how to apply the schema after provisioning.
- Document the D1 database ID output — needed for the Worker binding (ticket 07cafb).
</constraints>
<validation>
Run from the `infra/` directory:
```sh
tofu validate
tofu plan
```
</validation>
<commit>
`feat(quotesdb): define Cloudflare D1 database resource in OpenTofu`
</commit>