Skip to content

feat: Terraform peelability advisor (read-only carve-out scoring) (DEFERRED) #214

Closed

Description

@lex00

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:

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-.tf path 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).

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; --json carries 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 dedicated chant carve advise. Recommend folding under chant migrate (mirrors from: github).
  • Home: shared @intentius/chant/migrate HCL front-end vs per-lexicon migrate/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.
  • .tfstate default-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

Activity

  1. changed the title [-]feat: Terraform peelability advisor (read-only carve-out scoring)[/-] [+]feat: Terraform peelability advisor (read-only carve-out scoring) (DEFERRED)[/+] on Jun 8, 2026
  2. lex00 commented on Jun 8, 2026

    @lex00
    ContributorAuthor

    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.

  3. lex00 commented on Jul 22, 2026

    @lex00
    ContributorAuthor

    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/.tfstate parser exists anywhere, no terraform migrationSource, 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)

    Two plan details to update

    1. T4 command shape drifted. Current chant migrate operates on a single sourceFile with content detect/transform (cli/commands/migrate.ts:61), and the from values are CI dialects (github/forgejo). The proposed chant migrate advise --from <tf-dir> needs a directory estate + optional state-backend read — that does not fit the existing single-file migrationSource seam. Recommend the advisor be its own read-only command rather than folded under migrate. (Re-decides this ticket's "command surface" open decision.)
    2. T3 tier lookup is now satisfiable. The tier1/2/3 native-spec-map penalty can reuse the lexicon coverage tiers already carried by check-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions