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.
40 lines
1.8 KiB
Markdown
40 lines
1.8 KiB
Markdown
+++
|
|
title = "Set up infra/ OpenTofu project — providers.tf, terraform.tf, .gitignore for state"
|
|
priority = 8
|
|
status = "todo"
|
|
ticket_type = "task"
|
|
dependencies = ["07feaa"]
|
|
+++
|
|
|
|
<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).
|
|
</context>
|
|
|
|
<goal>
|
|
Bootstrap the OpenTofu project in `infra/`:
|
|
1. Create `infra/providers.tf` — declare the Cloudflare provider with the required version
|
|
2. `infra/terraform.tf` — **use the local file backend** (07feaa resolved: local file is the correct choice for this solo project). The local backend is OpenTofu's default, so no explicit `backend` block is needed in `terraform.tf`. The file only needs the `required_providers` block (already partially present in `main.tf` — move it to `terraform.tf` and remove from `main.tf`).
|
|
3. Create `infra/.gitignore` — ignore `*.tfstate`, `*.tfstate.backup`, `.terraform/`, `.terraform.lock.hcl`
|
|
4. Run `tofu init` to initialise the provider
|
|
</goal>
|
|
|
|
<constraints>
|
|
- State backend is **local file** (resolved by 07feaa). No `backend` block is required — omitting it uses the local default.
|
|
- The Cloudflare provider requires an API token — document the expected environment variable (`CLOUDFLARE_API_TOKEN`) in a comment in `providers.tf`, do not hardcode it.
|
|
- Every `resource` and `data` block must have a comment explaining its purpose (per CLAUDE.md).
|
|
- Note: `infra/main.tf` currently contains the `terraform` block — move it to `infra/terraform.tf` during this task.
|
|
</constraints>
|
|
|
|
<validation>
|
|
Run from the `infra/` directory:
|
|
|
|
```sh
|
|
tofu validate
|
|
tofu plan
|
|
```
|
|
</validation>
|
|
|
|
<commit>
|
|
`chore(quotesdb): bootstrap OpenTofu infra project with Cloudflare provider`
|
|
</commit>
|