Terraform Stacks Deferred Changes Planning Prompt
Plan and reason about deferred changes across Stack components so unknown-count expansions apply safely in dependency order
- Target user
- Platform teams adopting HCP Terraform Stacks
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Terraform/IaC engineer who specializes in HCP Terraform Stacks and the deferred-changes model for unknown-count component expansion. I will provide: - The Stack configuration (`tfstack.hcl` / `tfdeploy.hcl` components and deployments) - The dependency chain where one component's `for_each` depends on another component's output that is unknown until apply - The plan output showing components marked as "deferred" Your job: 1. **Map the deferred graph** — identify which components are fully planned now versus deferred because their `for_each` / inputs depend on not-yet-known upstream outputs. 2. **Explain each deferral** — for every deferred component, state precisely which unknown value triggered it and which upstream component must apply first. 3. **Order the apply rounds** — lay out the sequence of partial applies Stacks will perform, showing how deferred components become concrete after each round. 4. **Spot infinite/non-converging cases** — flag any cycle or value that will stay unknown across rounds and never resolve. 5. **Tighten inputs** — recommend where to use explicit `depends_on`, known-at-plan values, or restructured `for_each` keys to reduce unnecessary deferrals. 6. **Validate the deployment block** — check `tfdeploy.hcl` deployment inputs and orchestration rules against the deferred plan so auto-approve gates do not fire mid-expansion. 7. **Document the operator view** — describe what the team will see in the Stacks UI per round and what to verify before approving each. Output as: a deferral table (component, unknown input, blocking upstream, resolves-in-round), the recommended apply ordering, and any HCL changes. Never auto-approve deferred rounds blindly; review each round's plan and confirm the previously-unknown values resolved as expected before approving the next.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Terraform Stacks Deployments Design Prompt
Design a Terraform Stacks (HCP) configuration that splits components from deployments, so one set of modules fans out across regions, accounts, and environments with orchestrated dependency ordering.
-
Terragrunt to Native Stacks Migration Prompt
Evaluate and plan a migration from a Terragrunt DRY setup to native Terraform Stacks (or OpenTofu stacks) — mapping `terragrunt.hcl` patterns, dependencies, and generate blocks onto first-class language features.
-
HCP Terraform Agent Pool Design Prompt
Design HCP Terraform (Terraform Cloud) agent pools for private-network runs — tfe_agent_pool, allowed-workspaces scoping, agent tokens, self-hosted agent deployment, agent execution mode, scaling, and hardening the agent hosts.
-
Terraform Stack Component Decomposition Prompt
Decompose a sprawling Terraform stack into well-bounded components along state, blast-radius, and change-frequency seams — deciding what belongs in one state file versus separate stacks wired by remote-state outputs, without creating dependency tangles.
More Terraform prompts & error guides
Browse every Terraform prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.