Skip to content

AA2: the KV namespace from Terraform - #3

Merged
ruehowl merged 1 commit into
mainfrom
aa/2-the-kv-namespace
Oct 28, 2026
Merged

ruehowl merged 1 commit into
mainfrom
aa/2-the-kv-namespace

Conversation

@ruehowl

@ruehowl ruehowl commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

This adds infra/terraform/cloudflare-kv, kv-redis-starter's root renamed for this product.

  • One Workers KV namespace per environment, titled on the product's slug, because namespace titles are unique per account. When a namespace with that title already exists, the root adopts it instead of recreating it.
  • The wiring document: its id and title are lease-published as WIRING_CLOUDFLARE_KV. The app's build renders it into wrangler.jsonc.
  • What the KV binding holds: the rate-limit windows (ratelimit:<ip>:<window>) and the share links (fragment:<id>). The Worker sets every expiry, per write.

apps/web already waits for it since AA1: an enforced dependsOn on cloudflare-kv on a push to main, advisory on a pull request.

Checked:

  • terraform validate passes.
  • orun plan --trigger github-push-main --env stage plans cloudflare-kv.stage.terraform, then web.stage.verify-deploy, which depends on it.

Generated by Claude Code

infra/terraform/cloudflare-kv, kv-redis-starter's root renamed for this
product: one Workers KV namespace per environment, titled on the product's
slug (namespace titles are unique per account), adopted rather than
recreated when one with its title already exists, and its id and title
lease-published as the WIRING_CLOUDFLARE_KV document the app's build renders
into wrangler.jsonc. The KV binding holds the rate-limit windows and the
share links; every expiry is the Worker's, per write.

apps/web already waits for it (an enforced dependsOn on cloudflare-kv on a
push to main, advisory on a pull request), so the product's merge plans the
namespace's apply before the Worker's deploy, per environment: checked with
`orun plan --trigger github-push-main --env stage` (cloudflare-kv, then
web). The root validates with `terraform validate`.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PcpNVpFBcbeiX3EHdXfmn
@ruehowl
ruehowl merged commit 19e57d9 into main Oct 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants