Files
coder/provisioner
George K 50c785cc6d refactor(provisioner/terraform/scriptorder): stage script order resolution (#30481)
Runtime resolution needs to know which scripts are selected by
ordering rules. The previous monolithic resolver required runtime data
up front, forcing callers to either resolve every script or resolve
ordering rules twice.

Introduce a staged API:

```
  NewProgram
    -> FilterDataSources
    -> Prepare
    -> resolve selected script runtimes
    -> Finalize
```

`NewProgram` builds reusable state and configuration indexes and records
script lifecycle attributes. `Prepare` resolves declarations, selectors,
and lifecycle phases, and records the selected script addresses needed
for runtime resolution. `Finalize` accepts only caller-resolved runtime
bindings and constructs the dependency graphs.

Filtering remains caller-controlled so plan-time consumers can remove
destroyed coder_script_order instances using the saved-plan graph
before preparation. Existing validation, diagnostics, limits,
warnings, and deterministic graph construction are preserved.

This change establishes the API boundary required by later
Terraform-backed runtime resolution without wiring it into
provisioning.

Refs:
https://linear.app/codercom/issue/PLAT-545
https://linear.app/codercom/issue/PLAT-715
2026-10-09 19:12:38 -07:00
..