Repository navigation
Description
Spun out of #197 (strangler-fig carve-out) per critical review. #197's phase 1 (the read-only advisor) is the cheap, day-one-useful, adoption-driving slice. It is decoupled here as its own shippable issue. The emit / boundary-bridging / apply-graduation phases stay in #197 and are gated on adoption demand, not committed.
Summary
A read-only Terraform carve-out advisor: point it at a Terraform estate, get back a ranked peelability report of which resources/modules are easy to move to native chant and which should stay in Terraform. No emit, no patches, no runbook, no state mutation — pure analysis.
This is the slice of the strangler-fig story (#197) that earns its keep before any of the rest exists. It is useful on day one, it is a low-risk pure file/state read, and it is a viral on-ramp hook: "run it against your Terraform, see what's trivial to leave." It also de-risks the heavier #197 phases by validating the graph + scoring model in isolation first.
Why this is its own issue
#197 is a large, unscoped bet whose value is adoption, not core-deepening. Its phase 1 advisor is the only part that is (a) cheap, (b) useful with nothing else built, and (c) a marketing artifact in its own right. Shipping it alone produces the adoption signal that should gate whether the emit/boundary/apply phases are worth building at all.
Scope
In:
- Parse
.tf(and, decided in T2, optionally.tfstate). - Build the Terraform dependency graph (resource/module edges, inbound/outbound).
- Score each resource/module by peelability using the model from design: strangler-fig carve-out from Terraform (observe-first, incremental) (DEFERRED) #197.
- Rank and report — human summary +
--json.
Out (stays in #197, gated on demand):
- Emitting native chant source.
- Boundary bridging (data-source patches to surviving TF, deferred deploy-time inputs).
- The handoff runbook.
- Any apply / ownership-marker step.
The scoring model (from #197)
score = 100
- 12 * inbound # surviving resources that depend on this
- 4 * outbound # this depends on surviving resources
- 15 * (tier - 1) # native-spec map: tier1=0, tier2=-15, tier3=-30
- 10 * has_dynamic # count / for_each / data / unresolved interpolation
- 3 * (instances - 1) # state-expanded instance count
clamp 0..100 (unsupported provider → 0)
| Score | Band | Meaning |
|---|---|---|
| 80–100 | clean leaf | trivial to carve later |
| 50–79 | carvable w/ edits | has boundary work |
| 0–49 | leave in Terraform | unmappable or load-bearing |
Tasks (shippable; run in order)
T1 — .tf parse + graph. Parse HCL, build the resource/module dependency graph, classify inbound/outbound edges. No state read yet.
- AC: graph extracted from a multi-resource fixture; inbound/outbound edges correct; tests.
T2 — Decide and (if chosen) add .tfstate read. .tfstate is what makes count/for_each/data resolvable (unrolled instances, resolved values), but it turns a pure file transform into a state-backend read. Decide default-on vs opt-in --state <path>.
- AC: decision recorded; if added, instance counts + dynamic detection improve and are tested; pure-
.tfpath still works without state.
T3 — Peelability scoring. Implement the model above over the graph; map resource types to native-spec tiers via the target lexicon(s).
- AC: scores match the design: strangler-fig carve-out from Terraform (observe-first, incremental) (DEFERRED) #197 worked examples (bucket≈88, module.cdn≈64, vpc=0); tier lookup reuses lexicon metadata; tests.
T4 — Report surface. A read-only command — human summary (ranked, banded) + --json. No files written to the repo beyond an optional --report <path>.
- AC:
chant migrate advise --from <tf-dir>(or agreed surface) prints the ranked report;--jsoncarries the full per-resource breakdown; tests.
T5 — Docs + example. Run the advisor against a small fixture Terraform tree; document the bands and what each penalty means.
- AC: docs page; runnable example; explicitly states this advises only — it emits nothing and touches no live resource.
Open decisions (flag for build phase)
- Command surface:
chant migrate advise --from <tf>vs a dedicatedchant carve advise. Recommend folding underchant migrate(mirrorsfrom: github). - Home: shared
@intentius/chant/migrateHCL front-end vs per-lexiconmigrate/from-terraform/. Recommend the shared front-end (one parser, many lexicon tier-maps) — same question design: strangler-fig carve-out from Terraform (observe-first, incremental) (DEFERRED) #197 raises. .tfstatedefault-on vs opt-in → T2.
The gate (per #198)
This passes the umbrella gate as a migration/adoption tool, not as core-deepening or orchestration-accretion — and it is deliberately the only part of #197 committed up front. The rest of #197 stays gated on the adoption signal this produces.
Related
- design: strangler-fig carve-out from Terraform (observe-first, incremental) (DEFERRED) #197 — parent strangler-fig design (emit/boundary/apply phases remain there, gated on demand)
- research: umbrella — layered config, selective lifecycles, vendoring & positioning #198 — umbrella (positioning + sequencing)
lexicons/gitlab/src/migrate/from-github— the tiered/provenance/diagnostics precedent
Activity
[-]feat: Terraform peelability advisor (read-only carve-out scoring)[/-][+]feat: Terraform peelability advisor (read-only carve-out scoring) (DEFERRED)[/+]lex00 commentedon Jun 8, 2026
Deferred (2026-06-07). Per project decision, all Terraform features are deferred — chant is not prioritizing Terraform migration/advisory tooling now. Scope and the scoring model are unchanged; this is parked, not dropped. Reopen the build when the priority changes.
lex00 commentedon Jul 22, 2026
Refresh — substrate has moved since filing (2026-06-06 → 2026-07-21)
Re-verified this plan against the repo and everything closed since it was filed. The advisor itself is still greenfield (no HCL/
.tfstateparser exists anywhere, no terraformmigrationSource, no scoring) — nothing here is pre-empted. But a chunk of the substrate the strangler-fig story (#197) assumed as future machinery has since shipped, so this is a smaller build than the ticket implies, and two plan details are now stale.Substrate that now exists (didn't, or was thin, in June)
chant importfrom a live env (liveImportFromPlugins,cli/commands/import-live.test.ts). Backs the design: strangler-fig carve-out from Terraform (observe-first, incremental) (DEFERRED) #197 runbook's adopt step.chant graph --live(feat(graph): chant graph --live <env> — project provisioned resources into IR nodes #777) with per-lexicon reference/edge reconstruction (feat(graph): reconstruct live edges — per-lexicon reference resolver (AWS first) #778/feat(graph): enrich --live node attributes so edge reconstruction has references to match #784) and containment metadata (feat(graph): live containment/grouping metadata (VPC/subnet boundaries) #779) — directly reusable for T1's inbound/outbound edge classification.lifecycle diff --livenow emits--json(lifecycle diff --live: emit --json (LiveDiffResult per lexicon) for programmatic consumers #852) + observed metadata (lifecycle diff --live --json: include observed resource metadata (status/attributes) #862) + per-component stacks (6777baa); snapshot-vs-snapshot diff (lifecycle: diff two historical snapshots (saved T1 vs saved T2) #822);lifecycle rollbackPR (lifecycle: rollback command — open a PR restoring source to a git revision #873); reconcile cloud→code Ops (feat(loom): observe + reconcile lifecycle Ops (WatchOp drift, ReconcileOp cloud→code) #904).orphanclassification is live inlifecycle/live-diff.ts.concepts/lifecycle-models.mdxdial page this ticket links still exists.Two plan details to update
chant migrateoperates on a singlesourceFilewith contentdetect/transform(cli/commands/migrate.ts:61), and thefromvalues are CI dialects (github/forgejo). The proposedchant migrate advise --from <tf-dir>needs a directory estate + optional state-backend read — that does not fit the existing single-filemigrationSourceseam. Recommend the advisor be its own read-only command rather than folded undermigrate. (Re-decides this ticket's "command surface" open decision.)tier1/2/3native-spec-map penalty can reuse the lexicon coverage tiers already carried bycheck-lexicon.ts(tier1Pass) and generated resource metadata — the AC "tier lookup reuses lexicon metadata" is buildable today.Note for #197 (not this read-only ticket)
The Component contract (#551) shipped after both tickets were filed. #197's phase-2 emit target was "native chant source / module→composite"; a carved slice could now also project to a Component. Add it as a candidate emit target when/if #197's gated phases are picked up.
Gate unchanged
Still DEFERRED. No adoption signal has arrived to trigger #197's gated phases, and the defer-all-Terraform policy stands. This is a bookkeeping refresh so the estimate/surface isn't misleading next read.
feat(carve): read-only Terraform peelability advisor (#214) (#993)
feat(carve): carve apply — graduation + full carve-out docs (#197) (#997