Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Terraform Difficulty: Advanced ClaudeChatGPT

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

More Terraform prompts & error guides

Browse every Terraform prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.