Migrate an existing Terraform codebase and state to OpenTofu

domain: opentofu.org · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Install the tofu CLI alongside (or in place of) terraform on developer machines and CI runners.
  2. Run tofu init -upgrade in each root module so OpenTofu resolves providers and modules through its own registry/lockfile instead of reusing cached Terraform-registry data.
  3. Run tofu plan and confirm it reports no changes against the existing state, since OpenTofu reads and writes the same state file format as Terraform without conversion.
  4. Update CI/CD pipeline scripts, Makefiles, and pre-commit hooks to invoke tofu instead of terraform for plan/apply/fmt/validate steps.
  5. Roll out to non-production workspaces first, keep the ability to fall back to terraform for a period, then migrate production once the non-prod run has been validated.

Known gotchas

Related routes

Use OpenTofu native state encryption to encrypt Terraform-compatible state at rest with a passphrase-derived key before storing in an S3-compatible backend
opentofu.org · 5 steps · unrated
Use OpenTofu's native state encryption feature to encrypt Terraform state at rest with a passphrase-derived key before storing it in an S3 backend
OpenTofu · 6 steps · unrated
Import existing cloud resources into Terraform without recreating them
terraform · 4 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans