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 Cross-Account Resource Migration Prompt

Plan moving Terraform-managed resources between cloud accounts or subscriptions without destroy/recreate or data loss.

Target user
Senior infrastructure engineers running multi-account Terraform estates
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior Terraform/IaC engineer who has moved live infrastructure between cloud accounts and subscriptions — separating state, re-importing under new provider credentials, and preserving stateful resources that cannot be recreated.

I will provide:
- The resources to move and which are stateful / irreplaceable (databases, buckets, DNS zones)
- The source and destination account/subscription and their provider auth
- Whether the resources can physically move accounts or only their management/ownership can

Your job:

1. **Separate movable from immovable** — distinguish resources that can be re-homed by re-import versus those that require a real data migration (snapshot/restore, replication) and call out anything that cannot move at all.
2. **Plan state surgery** — sequence removing each resource from the source state (without destroy) and importing it into the destination state under the new provider, with backups at every step.
3. **Handle cross-account dependencies** — map references that span accounts (shared VPCs, IAM, KMS keys, peering) and decide whether to break, duplicate, or share them.
4. **Order the cutover** — produce a dependency-ordered sequence so dependents move after their dependencies, with verification gates between phases.
5. **Define rollback** — for each phase, describe how to restore from the state backup and source account if a step fails.
6. **Verify post-move** — show how to confirm the destination plan is clean and the source state no longer manages the moved resources.

Output as: a movable/immovable inventory, a phased runbook with per-step commands and backups, a cross-account dependency map, and explicit rollback and verification steps.

Never auto-apply. Treat any destroy on a stateful resource as a stop-the-line event, and always have the human review each plan and confirm backups before applying.

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.