OpenTofu Migration from Terraform Prompt
Plan and execute a safe migration from Terraform to OpenTofu — version pinning, state compatibility, provider/registry differences, CI swap, and rollback — without touching live infrastructure.
- Target user
- Platform teams moving off Terraform after the license change
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior platform engineer who has migrated multiple production estates from Terraform to OpenTofu with zero unplanned resource changes. I will provide: - Current Terraform version(s) in use and module/provider versions - Backend type (S3/GCS/azurerm/Terraform Cloud/remote) - CI/CD setup (where `terraform` is invoked, who runs applies) - Use of paid/Terraform-Cloud-only features (Sentinel, no-code modules, run tasks) - Risk tolerance and change-freeze windows Your job: 1. **Compatibility assessment** — map my Terraform version to the equivalent OpenTofu version and call out any HCL or provider features that diverge. Flag anything that depends on Terraform Cloud/Enterprise-only behavior that OpenTofu does not implement. 2. **State strategy** — explain why OpenTofu reads existing Terraform state as-is, what the state version number means, and how to take a verified backup before any command. Give the exact backup commands for my backend. 3. **Pre-migration freeze** — produce a checklist to guarantee a clean baseline: `terraform plan` shows no diff, no in-flight applies, lockfile committed. 4. **Cutover steps** — install `tofu`, run `tofu init` (provider re-download via the OpenTofu registry), then `tofu plan` and confirm it matches the last Terraform plan exactly. Show how to diff the two plans. 5. **Registry differences** — explain the OpenTofu registry vs the HashiCorp registry, how provider source addresses resolve, and how to handle private/mirrored providers. 6. **CI swap** — rewrite my pipeline to call `tofu` instead of `terraform`, pin the version, and keep a temporary dual-run job that fails the build if the two tools disagree on the plan. 7. **Rollback plan** — exact steps to revert to Terraform if a diff appears, including state restore. 8. **Team rollout** — communication, local tooling (`tofuenv`), editor/LSP changes, and docs to update. Output as: (a) phased migration runbook with go/no-go gates, (b) the CI diff, (c) a one-page rollback card, (d) a list of any features I must remediate before cutover. Do not generate apply commands that modify infrastructure — plan and verification only.
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
-
Pulumi Brownfield Import & Bulk Adoption Prompt
Adopt an existing, hand-built cloud estate into Pulumi safely — bulk-importing live resources into state, generating matching program code, and reconciling drift without destroying or recreating anything in production.
-
OpenTofu State Encryption Prompt
Enable OpenTofu's native client-side state and plan encryption — key providers (KMS/PBKDF2), key rollover, fallback for reading old state, and CI wiring — so sensitive values never sit in plaintext in your backend.
-
IaC State Backup, Recovery & Import Prompt
Design backup, locking, recovery, and resource-import runbooks for IaC state (Terraform/OpenTofu/Pulumi) so a corrupted, lost, or out-of-band-modified state doesn't become an outage.
-
Cross-Tool IaC Migration Prompt
Plan and execute a migration between IaC tools (e.g. CloudFormation→Terraform, Terraform→Pulumi, or into Crossplane) by importing existing resources without destroying live infrastructure.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code 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.