Skip to content

feat(adopt): self-healing terraform adoption — import existing infra when platform state is empty - #35

Merged
ruehowl merged 7 commits into
mainfrom
feat/terraform-adopt-existing
Jul 28, 2026
Merged

ruehowl merged 7 commits into
mainfrom
feat/terraform-adopt-existing

Conversation

@ruehowl

@ruehowl ruehowl commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #34 (merged with the platform state still empty): the kv apply on main fails 10014 on the duplicate namespace title, and supabase/hyperdrive would collide the same way once their lanes unblock.

Each terraform root gains an adopt.tf: a config-driven import block whose id is looked up at plan time by an external data source running inside the job — it first checks the platform state over TF_HTTP_* (already tracked → inert), then asks the provider API with the job's brokered credentials (KV namespace by title, Hyperdrive config by name, Supabase project by name+org). Fresh products resolve to no-op and create normally.

This retires the AWS-dependent tfstate-to-orun.sh migration for these roots — a baseline whose state predates the platform backend adopts its own live infra on first apply. random_password cannot be adopted, so the supabase root documents the database-password reset as the cutover (same run republishes credentials through job-output secrets and re-wires every consumer).

Lock files regenerated with linux_amd64/linux_arm64/darwin_arm64 hashes; all three roots terraform validate clean.

🤖 Generated with Claude Code

varahul and others added 7 commits July 29, 2026 00:28
…when platform state is empty

Config-driven import blocks (kv namespace by title, hyperdrive config by
name, supabase project by name+org) whose ids are looked up at plan time by
an external data source running inside the job: it first checks the
platform state over TF_HTTP_* (already tracked → inert), then asks the
provider API with the job's brokered credentials. Fresh products resolve to
no-op and create normally.

This retires the AWS-dependent tfstate-to-orun.sh migration for these
roots: a baseline whose state predates the platform backend adopts its own
live infra on first apply — no S3 read, no AWS credentials. random_password
is the one resource that cannot be adopted, so the supabase root documents
the database-password reset as the cutover: the same run republishes the
new credentials through job-output secrets and re-wires every consumer.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A fork deploying into the same Cloudflare account legitimately keeps the
baseline's workers.dev subdomain (worker names are already brand-prefixed).
The leftover sweep flagged it anyway, exited 1 mid-bootstrap, and silently
skipped every later hook — the intent workspace had to be patched by hand
on the nimbus instantiation. The subdomain now joins the residue set only
when the values file actually changes it; --verify (fork-side, no values)
skips it for the same reason.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…esume

bootstrap-flow.yaml replaces the seven batch steps with one main push that
un-parks the whole fleet (park.mjs unpark --all; cloudflare-domain stays
parked) with feedback edges stripped, rides ONE convergence run to green
(flows/converge.sh: gh run rerun --failed resume, budget 3 — CI is
exec-id+--retry resume-capable), restores the bindings with a second push,
and verifies live endpoints. Preflight now POLLS for active provider
connections (10m) so the two OAuth consents can be clicked while the flow
runs instead of failing it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BOOTSTRAP.md is the operator runbook from blueprint to live baseline (one
workflow + two OAuth consents, target under an hour), with the full
troubleshooting table from the nimbus instantiation. flows/README.md now
describes the single-run flow (no batches, no AWS prerequisite) and the
first-boot ordering guarantees that make one convergence run sufficient.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
With --retry unconditional, the v2.49.0 dep-grace made dependents of a
genuinely failed upstream wait the full 30-minute dependency deadline on
FRESH runs too (observed: hyperdrive/supabase-prod lanes hanging behind the
orphaned-secret supabase failure). Gate it on GITHUB_RUN_ATTEMPT > 1: the
grace applies exactly where the resume race exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ruehowl
ruehowl merged commit ee1a56a into main Jul 28, 2026
3 of 7 checks passed
@ruehowl
ruehowl deleted the feat/terraform-adopt-existing branch July 28, 2026 19:39
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