A Generic Stack and Terraform Stacks Are Different Terms
A runbook says: apply the stack in order, network then data then app. That sentence describes a convention, not a Terraform object. Three root modules sit in three directories with three backends, three provider configurations and three credentials, and a pipeline or a person enforces the sequence. Nothing in the configuration declares that these roots form a unit, because Terraform has no such declaration to make. Weeks later the same team reads that Terraform Stacks has components and deployments, assumes it is that convention with new file names, and budgets a fortnight for a rename. The two ideas share a word and almost nothing else.
An informal stack — the field term for a set of root modules applied in a known order — is an architectural pattern. Each root owns its state, variables and cloud identity; coordination happens through published outputs, terraform_remote_state data sources, run triggers, or a CI job with a hard-coded sequence. The ordering lives outside Terraform. The contract between layers is whatever output name happened to survive the last refactor.
Terraform Stacks is a product feature with its own configuration language and execution model, available in HCP Terraform and in Terraform Enterprise 2.0 or later on resources-under-management plans, as documented in November 2026. It replaces the root module with a component configuration, adds a deployment configuration that instantiates that blueprint repeatedly, and runs the result on the hosted control plane. A Stack is an object inside a project, with configuration versions, deployment runs, per-deployment state and permissions inherited from that project. There is no community-edition path that turns a directory into a Stack: the terraform stacks commands are a client for a host, not a local engine.
The construction analogy keeps the two apart. An informal stack is a group of subcontractors who each keep their own ledger and hand a sheet of paper to the next trade; if the sheet changes format, the next trade builds from a stale number and nobody notices until inspection. A Stack is one general contractor holding a master drawing, with one schedule and one inspection regime — but each site still keeps its own ledger, because each deployment has its own state. The contractor also decides when a crew may start, which is the part a pipeline cannot do: a pipeline knows order, while a Stack knows dependencies.
Figure 1 contrasts the two shapes and the failure each one invites.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
subgraph GEN["Informal stack: separate roots, separate contracts"]
R1["Root network-dev
own state · own credential"]
H1["Handoff sheet
remote state output or pipeline variable"]
R2["Root app-dev
own state · own credential"]
F1["Output renamed or retyped:
the consumer plans against nothing"]
end
subgraph STK["Terraform Stacks: one blueprint, many deployments"]
C1["tfcomponent.hcl
component network → component app"]
D1["tfdeploy.hcl
deployment dev · deployment prod"]
E1["Hosted execution
dependency-aware plan per deployment"]
V1["terraform stacks validate
dangling reference fails before any run"]
end
R1 --> H1
H1 --> R2
H1 -. "silent break" .-> F1
C1 --> D1
D1 --> E1
C1 -.-> V1
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class R1,R2 primary;
class H1,C1,D1 secondary;
class E1,V1 ok;
class F1 danger;
The distinction is not cosmetic. If your problem is ordering, a CI pipeline already solves it, and Stacks adds a migration plus a feature gap. If your problem is that one system spans several modules whose dependencies are invisible to any single plan, Stacks addresses something no pipeline can see. Figure 2 draws the boundary that matters when you explain this to a sponsor: the informal stack's boundary is the pipeline, while the Stack's boundary is the project object and its execution plane.
Components Reuse Modules; Deployments Instantiate Environments
Two file types carry the whole model, and each answers a different question.
A component configuration replaces the root module. It holds provider setup, variables, outputs and the component blocks that point at modules; every file of that type in the Stack root is read as one unit.
| File | Question it answers | What it declares | What it cannot do |
|---|---|---|---|
.tfcomponent.hcl | What exists, and how it is wired | required_providers, provider, variable, output and component blocks | No backend block, no per-component state, no local apply |
.tfdeploy.hcl | How many copies exist, and what differs | deployment, deployment_group, identity_token, store, publish_output and upstream_input blocks | No Stack without a deployment; the ceiling is 20 deployments |
A component is not a root module
No backend block, no state of its own, no cloud block and no apply. Add one component per top-level module; child modules stay inside that module as before.
All component files in the Stack root are read together. Splitting variables and components across two files is normal, and a .terraform-version file pins the release. The terraform stacks command group needs Terraform 1.13 or later. The split is a division of blast radius as much as of syntax:
The component reference is the whole difference. That component.network.vpc_id edge exists in configuration, so the engine knows the second component cannot be planned until the first has produced a value. No output name has to be guessed, and no data source has to read a state file it does not own.
The deployment file repeats that blueprint:
Change fan-out is asymmetric. Editing a component produces a new configuration version that every deployment plans, because all of them share the blueprint. Editing one deployment's inputs produces a run for that deployment only. That is the correct default for a fleet of identical environments, and the wrong default for a system whose environments have genuinely diverged — the kind of divergence that made someone create prod-legacy in the first place.
Figure 3 shows the three layers and where state lands. Module code is unchanged; the component file declares the blueprint; the deployment file declares the instances; and each deployment writes one state file containing all of its components.
Figure 4 traces the path from a local configuration to a converged deployment, including the two branches that stop a rollout: a configuration that fails validation, and a plan that cannot be approved past a policy.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
CFG["Configuration version
tfcomponent.hcl + tfdeploy.hcl"] --> VAL{"terraform stacks validate
local or in CI"}
VAL -. "backend block, unsupported function" .-> BAD["Rejected before push
no deployment run created"]
VAL --> FETCH["Push to the host
configuration version stored"]
FETCH --> PLAN["Plan each deployment
components in dependency order"]
PLAN --> DEF{"Inputs unknown
at plan time?"}
DEF -. "yes" .-> DEFER["Step deferred
recorded in the plan"]
DEF --> GATE{"Policy evaluation
if a policy set applies"}
DEFER --> GATE
GATE -. "mandatory failure" .-> HALT["Deployment halted
approval cannot override"]
GATE --> APP{"Auto-approve rule
or operator decision"}
APP -. "pending or rejected" .-> HOLD["Plan waits
other deployments carry on"]
APP --> APPLY["Apply the steps that can run"]
APPLY --> CONV{"Convergence check
empty plan?"}
CONV -. "no, still deferred" .-> PLAN
CONV --> DONE["Converged
state written and unlocked"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class CFG,PLAN,APPLY primary;
class FETCH,DEF,GATE,APP,CONV secondary;
class DONE ok;
class BAD,HALT danger;
class DEFER,HOLD warn;
Dependencies Can Defer Planning Until Values Exist
A reference outside the root is invisible to the plan. A conventional root plan builds one graph for one state, so edges inside the graph are planned in order while edges that leave it are not. If the app component reads the network component's VPC ID through a remote-state data source, the plan sees whatever the upstream state held when planning began. If the upstream changed five minutes ago and has not applied, the app plans against the old world; if it has never applied, the data source returns nothing and the plan fails before proposing anything.
Terraform can already defer inside one root. It can mark a resource as deferred when a value is unknown until apply, then produce a follow-up plan. But the boundary of that graph is still the root: two roots, two graphs, and the ordering between them remains a pipeline decision.
Stacks move the boundary outward. Because components live in one configuration, HCP Terraform builds one dependency graph across them and, when a component's inputs cannot exist yet, it defers that component's step instead of failing or planning from a guess. You approve what can run; HCP Terraform applies it and then creates a follow-up plan for the deferred steps. After every apply, a convergence check replans and keeps going until a plan comes back empty. The usual example is a Kubernetes cluster component and a workloads component whose provider needs the live cluster endpoint: in separate roots that is two pipelines and a handoff, while in a Stack it is one deployment run with two cycles.
Four consequences belong in the design note, because each one changes an operational answer.
- One approval is not one apply. Approving a plan that contains deferred changes authorizes the follow-up plans that Terraform generates. The number of applies is a property of the graph, not of your approval count, so a change-control form that asks "how many applies will this be?" needs a different answer.
- Concurrency is spent per cycle. Every follow-up plan and apply takes a run slot from the same pool as workspaces. A twenty-deployment Stack rolling out a deferred component can consume more capacity than the workspace design it replaced. Setting
eager_plan = "off"on a deployment group holds plans until you start the group, which is the documented way to stage a wide rollout. - Policy runs per cycle. A policy evaluated in cycle one can fail in cycle three because the plan changed. That is correct behaviour and a poor fit for an approval process that assumes the approved plan is the applied plan.
- A non-converging deployment stays open. If a deferred step never becomes plannable, the deployment sits mid-rollout with some components applied and others not. The unit that recovers is the deployment, not the component, because that is the unit of state.
Deferral is declared, not discovered
Deferral follows references written in the configuration. A value fetched by a script, copied into a variable set, or read from a tag is still an invisible edge; no execution model can schedule what the configuration does not declare.
A deferred plan is a partial answer. The review record needs three facts alongside it: which components were deferred, which reference caused each deferral, and what the follow-up cycle is expected to create. An approval that cites only the first plan leaves no evidence about the cycle that actually built the workload, and the run history is the place to keep every cycle rather than the summary.
Review State, Credentials and Cross-Deployment Data
State is where the model most sharply departs from workspaces. HCP Terraform stores one state file per deployment, and that file contains every component in the deployment. Two components in the same environment share a lock and a state version, while a production apply leaves development untouched.
The deployment is the state boundary
Isolation runs between deployments, not between components. A drifted or damaged component affects its neighbours in the same deployment, so a repair restores a deployment rather than a component.
State is managed through configuration, not state surgery. There is no terraform state mv or terraform state rm against a Stack. The documented levers are editing a component block, adding or removing a deployment block, using the removed block for cleanup, and setting destroy on a deployment. Removing a deployment block and applying deletes that deployment and its state file. The UI redacts sensitive values, but they are still stored, exactly as in workspace state.
Credentials attach per deployment. An identity_token block declares an audience, and the deployment receives a short-lived JWT that components and providers exchange through OIDC. The production deployment assumes a production role and the development deployment a development role from the same blueprint.
A store block reads values from a variable set. The Stack must be allowed to see that set: global scope, or assigned to the containing project or the Stack itself. Dynamic provider credentials are supported for Stacks, and agent pools can be scoped to them. Permissions still decide who may run a deployment; the cloud identity decides what that deployment can reach.
Cross-Stack data has two interfaces and no third, as of November 2026. Inside a Stack, one component consumes another's output through a component reference, and both live in the same deployment. Across Stacks, a publish_output block exposes a value and an upstream_input block in a downstream Stack consumes it.
The constraints are project scope and a published snapshot. Downstream Stacks must be in the same project. If the upstream value changes after a run, HCP Terraform triggers downstream runs automatically; if no published snapshot exists, the downstream run fails rather than reading a stale value. The documented ceilings are 20 upstream Stacks and 25 downstream Stacks.
Deployment-to-deployment wiring is refused, not missing. Nothing documented lets the production deployment read the development deployment's outputs. It matches the workspace rule that environments exchanging live values stop being independent. When two environments need the same value, put it in locals, a variable set, or the component configuration, not in a peer's state.
The remaining limits are ordinary capacity planning, and they bite earlier than most teams expect: 20 deployments, 100 components and 10,000 resources per Stack. A hundred components sounds generous until a component-per-service design meets a large estate, and 10,000 resources can be smaller than one large account's footprint. Those numbers are a decomposition instruction, not a footnote.
Compare Policies and Execution Availability
Stacks are not a Terraform CLI feature. Execution happens in HCP Terraform or Terraform Enterprise 2.0 or later, and the command group is a control-plane client rather than a local engine. It spans init, validate, fmt, providers-lock, create, list, diagnostics, deployment-run, deployment-group, configuration and migrate, but there is no terraform stacks plan that writes a local plan file and no local apply.
No local plan artifact
A pipeline that expects to produce and archive a plan on the runner has to change shape. On Terraform Enterprise, set TF_STACKS_HOSTNAME before the CLI will talk to your instance.
Version floor. The plugin requires Terraform 1.13 or later; the configuration example in this article was checked against the 1.17 documentation on 5 November 2026.
Execution placement is a separate decision. Remote execution on HashiCorp's workers is the default and the least to operate when providers reach public endpoints. Self-hosted agents are supported for Stacks, so a Stack that must reach a private network can run inside your boundary while the control plane stays hosted; agent pools can be scoped to a Stack.
Placement does not move the data. Deployment state, variables, run metadata and logs remain in the host, which matters when residency is a requirement rather than a preference.
Entitlements disagree in the documentation
The Stack-versus-workspace comparison page marks policy as code unsupported, while the Stacks policy-enforcement page documents Terraform-policy evaluation after each deployment plan, limited to Stacks running Terraform 1.17 or later. The same comparison page marks drift detection, continuous validation, cost estimation, run tasks, run triggers, private registry publishing, no-code provisioning and ephemeral workspaces as unsupported. Orchestration rules are attributed to Plus in one place and Premium in another; the plan matrix and the Free plan description also disagree. None of this is a reason to avoid Stacks; it is a reason to date-stamp an entitlement record and take the feature page, the comparison page and the contract to the same meeting.
Figure 5 shows the trade as a control surface, not a score.
| Capability | Workspace route | Stack route | What changes for you |
|---|---|---|---|
| Local plan and apply | terraform plan and apply in the root | No local plan or apply; terraform stacks targets a host | CI cannot archive a plan produced on the runner |
| Policy engine | Sentinel, OPA, or Terraform policy | Terraform policy only, evaluated after each deployment plan | No pre-plan gate, no post-apply gate, Terraform 1.17+ |
| Drift detection | Supported | Not supported | Detection moves to a scheduled job or another product |
| Continuous validation | check blocks in health assessments | Not supported | Assertions move into tests or monitoring |
| Cost estimation | Standard and Premium | Not supported | Budget review happens before the run, not during it |
| Run tasks | Pre and post plan and apply | Not supported | Third-party gates become pipeline steps |
| Cross-environment data | Run triggers and remote state | publish_output and upstream_input, same project only | Coupling is declared in configuration, not scripted |
| Approvals | Per workspace, with auto-apply | Per deployment, with auto-approve rules and failure tolerance | Rule authoring replaces a toggle |
| Ceiling | Concurrency per workspace | 20 deployments, 100 components, 10,000 resources | Split the system before you reach the cap |
Two of those rows decide more adoptions than the rest. Policy is the one teams assume transfers, and it transfers only partly: a Stack can be blocked after a plan, but a policy that must refuse a configuration before planning has no equivalent. Drift detection is the one teams discover missing a quarter later, when the first manual console change goes unnoticed. If either control is a stated requirement, Stacks is not the right vehicle yet, however appealing the orchestration is.
Choose Stacks Only After a Small Rehearsal
The decision is not which product is better. It is whether this system needs dependency-aware planning badly enough to give up four controls and change its execution surface. That question cannot be answered from a feature page, because the cost lands in the ordinary week: who approves, what a run looks like when it fails at cycle three, what the on-call engineer can see at 02:00.
Rehearse with two environments and the smallest real system you already run. Build it twice on paper, then once in a sandbox if the account allows.
As separate roots it is four workspaces — network-dev, network-prod, app-dev, app-prod — four states, at least two cloud identities if you have split them properly, a handoff from network to app, and an ordering mechanism. The mechanism might be a pipeline, a run trigger, or a human following a runbook; each choice has a failure mode you already know.
As a Stack it is two components and two deployments. One configuration version, two states, one identity per deployment through OIDC, one dependency edge from the app component to the network component that the engine can see, and deferred planning when the app needs the network's value before it exists. What disappears is the handoff code and the ordering script. What also disappears is drift detection, cost estimation, run tasks, and any policy that must run before the plan.
Change fan-out is the dimension teams under-rate. In the workspace design, a shared module bump is four pull requests or four workspace runs that you can sequence and pause. In the Stack, one merged component change queues a plan for both deployments at once — which is the benefit, and also the risk, because a bad blueprint reaches production on the same configuration version that reached development. Deployment groups are the mitigation: failure_tolerance = 0 serialises the group and halts the rollout when the first deployment fails, and auto-approve rules can be written to admit only empty plans in a staging group.
Evaluate a Stacks design
Status: design-only. Every step runs on paper or with local validation. Nothing is applied, no Stack is created, and no cloud credential is used. The local validation step needs Terraform 1.17.1 and a scratch directory.
Prerequisites. A system you already run as two root modules across two environments, the ability to read one recent change's timeline, and a copy of the current Stack-versus-workspace comparison page.
Setup. Create labs/p33/ and the four records below; use placeholders for organisation, project and module names.
| Artifact | What it records |
|---|---|
baseline.md | Current workspaces, states, credentials, handoff and one measured change |
stack-design.md | Component graph, deployment inputs and identity per environment |
entitlements.md | Dated edition, ceilings and control status with citations |
decision.md | Adopt, defer or reject, with evidence and exit path |
evidence/ | Quoted pages, validation output and the abandoned assumption |
The local validation sequence. Run these in a scratch directory after writing the two configuration files:
terraform stacks init
terraform stacks validate
terraform stacks fmt
- Baseline the current shape. In
baseline.md, record workspaces, state files, credentials, the handoff between roots, and who or what enforces order. Measure one recent change: commit time, plan time, approval wait, apply time, and how many runs it took. Pass only if you can name the handoff mechanism without saying "the pipeline". - Baseline the controls. List which of these you actually use today: drift detection, continuous validation, cost estimation, run tasks, policy before plan, policy after plan, run triggers. Mark each as required, nice-to-have, or unused, with the person who would object to losing it.
- Split into components. One component per top-level module; child modules stay inside. Name components after what they manage. Draw every
component.<name>.<output>reference, because each one is a deferred-plan candidate. Fail the step if two components would need each other's outputs in both directions. - Write the deployment file on paper. Two deployments with their input values, one
identity_tokenaudience per environment, and astoreblock for shared values. Record which values are shared locals and which are genuinely per-deployment. If more than a handful differ, the environments have diverged and the Stack is the wrong shape. - Decide the group rules. Write the
deployment_auto_approveconditions you would actually trust — typically an empty plan for a staging group — and setfailure_tolerance = 0for a production group so the rollout halts on the first failure. Note who approves a plan that contains deferred changes, since that approval also authorises the follow-up plans. - Validate locally, before any host exists. In a scratch directory with a Terraform 1.17.1 version file, write a minimal component file and deployment file, then run the three commands above in order. Expected observation: validation accepts the component and deployment blocks, rejects a backend block or an unsupported function, and produces no plan — the difference from a local plan.
- Fill the entitlement record. In
entitlements.md, record the date, the host, the plan edition, the deployment, component and resource ceilings, whether policy for Stacks is available at your Terraform version, and the status of each control from step 2. Quote the exact sentence and URL. Where the comparison page and a feature page disagree, say so and record which one the contract supports. - Write the decision. In
decision.md, state adopt, defer or reject, the evidence that decided it, the conditions that would reopen it, and the exit path. Note that the migration tooling is documented as experimental, so the exit path is a rebuild, not a button.
Pass criteria. A baseline with measured timings, a component graph with no cycles, two deployments whose inputs differ only where environments genuinely differ, an identity per deployment, and a dated entitlement record with a citation per claim. Reject the design if the only reason for Stacks is "fewer repositories", if a required control is on the unsupported list, or if the deployment count would approach 20.
Cost and cleanup. Design-only: zero. The validation step creates only provider lock data. A later sandbox Stack bills managed resources through the same resources-under-management meter as workspaces, so destroy deployments and delete the Stack after capturing evidence.
Evidence to keep. The four files, the quoted entitlement page, the terminal output of validate, and one paragraph on the assumption you had to abandon.
Next in the Series
In Terraform and OpenTofu: Licensing, Divergence and Migration, we'll explore Compare the projects using current licenses and a tested migration path instead of assuming interchangeability.