Migrating from Terraform to OpenTofu

Moving from Terraform to OpenTofu is mostly a state, backend and CI task when configurations are standard. Shared state through terraform_remote_state, pinned provider versions and HCP Terraform-hosted features need more review before cutover.

On this page

Migrate from Terraform to OpenTofu: what the move involves

OpenTofu's documented migration path has four steps: back up state and code, install OpenTofu, initialize and verify the configuration, then test with a small change. The effort depends more on state, backends, CI pipelines and provider version pins than on rewriting HCL, because OpenTofu describes itself as a drop-in replacement that preserves existing workflows and configurations. This page covers the technical move only and is not legal advice. Terraform 1.6.0 and later are licensed under IBM's Business Source License 1.1, while OpenTofu is licensed under the Mozilla Public License 2.0. Whether your current use fits the license's production grant depends on how you use and offer Terraform, so confirm your license position with counsel before you set a cutover date.

Start with state, because it is the part you cannot easily undo. Inventory every backend that holds state, including remote backends, and record the current state version for each workspace before you run anything. Check whether any configuration reads another stack through the terraform_remote_state data source, since those configurations typically need additional care during migration. If you plan to use OpenTofu's state encryption, which was introduced in v1.7 and covers state and plan files for local and remote backends, choose a key provider from PBKDF2, AWS KMS, GCP KMS, OpenBao or Azure Vault before the first run. Document where its keys are held, because losing them would make the encrypted state unreadable. Finally, pin the OpenTofu version in CI and in every developer environment, since OpenTofu's FAQ states that compatibility with future Terraform releases is not guaranteed.

Then look at what runs outside laptops. CI jobs, policy checks and any runner such as Atlantis or Terrakube need the OpenTofu binary and their own version pin, and provider lock files should be regenerated and reviewed in the same change. Plan the cutover around a small, non-production change that runs through OpenTofu and produces a plan you can compare with the last Terraform plan, following the test step in the OpenTofu migration overview. Keep the Terraform binary and a state backup available until the team has confirmed the first real apply, because the overview describes the process as designed to be safe and reversible. Ask your pipeline owners to list every provider and module the code depends on and to confirm each one in the OpenTofu Registry before the cutover date.

Why teams move from Terraform to OpenTofu, and when staying makes sense

Teams in this group want an open license and neutral governance more than they want the licensor's support. OpenTofu is licensed under the Mozilla Public License 2.0, is under the Linux Foundation's stewardship and was accepted to the CNCF Sandbox on April 23, 2025. The project describes itself as a drop-in replacement for Terraform, so the switch centers on the tooling and its release process.

  • License direction: Terraform moved to the Business Source License 1.1 for version 1.6.0 and later after HashiCorp announced the change on August 10, 2023. This matters most if your policy requires an open source license for core tooling.
  • Neutral governance: Linux Foundation stewardship means no single company sets the roadmap. The Sandbox is the early CNCF maturity level, so confirm the governance and release process meet your review.
  • Compatibility risk: the project aims for feature parity with Terraform but does not guarantee compatibility with future Terraform releases. Pin versions and test provider upgrades if you plan to track Terraform later.
  • Newer features: OpenTofu added state and plan encryption at rest in v1.7, with key providers including AWS KMS, GCP KMS, OpenBao and Azure Vault. This matters if audit evidence requires encrypted state files.

Confirm which OpenTofu version your pipelines will pin, and check that every provider and module you use is tested against it.

What maps cleanly from Terraform to OpenTofu and what does not

This table compares each Terraform capability with its OpenTofu equivalent and the notes that apply during migration. Read the notes before you start, because state, shared data and hosted features need a check in your own environment. The main takeaway is that HCL and provider code usually carry over after a plan diff, while state, remote data sharing and HCP Terraform features need a written inventory first.

Source capabilityOpenTofu equivalentMigration notes
HCL configurationDrop-in replacement for Terraform configuration files and workflowsConfirm the move with a plan diff against current state before any apply.
Providers and modulesOpenTofu Registry with more than 3,900 providers and 23,600 modulesCheck that each provider and module source and version resolves, then review the dependency lock file diff.
State files and remote backendsExisting backend configuration, initialized with OpenTofu after a state backupBack up state first and confirm your backend type, including locking and access, before running init.
terraform_remote_state consumersCovered by a separate guide linked from the OpenTofu migration overviewGive these configurations extra care, sequence producer and consumer migrations, and test each downstream read.
State and plan encryptionAddition: at-rest encryption for state and plan files, introduced in v1.7Not a mapping from Terraform. Choose a key provider (PBKDF2, AWS KMS, GCP KMS, OpenBao or Azure Vault) and set key recovery before enabling.
Features added after the forkEarly evaluation of variables and locals (v1.8); provider for_each and -exclude flag (v1.9)Additions with no direct mapping. Code that uses them may not run on Terraform, so plan the reverse path.
HCP Terraform-hosted featuresHosted runs and policy controls are not part of the OpenTofu CLI; replacements varyList the hosted features your team uses, then confirm whether a self-hosted or third-party replacement exists for each.

Documented migration steps and the tools behind them

OpenTofu's documented path runs in four steps: back up, install alongside Terraform, initialize and verify, then test with a small change. The cards follow that order, then add the shared-data case and an optional encryption step after the move. Each step gives you a checkpoint to return to until the plan and the trial apply both match what you expect.

Back up state and code

OpenTofu's migration overview opens with this step, and it is what makes every later step reversible. Pull the current state with terraform state pull, store a copy outside the working directory, and tag the commit that matches the live configuration. Record the exact Terraform version in use, since that is the version a rollback returns to. Confirm that your state backend keeps prior versions and that named people can restore them before anyone runs a write. Keep a restorable state copy before the first OpenTofu command touches the backend.

Migration overview

Install OpenTofu alongside Terraform

Install the OpenTofu binary beside the Terraform binary and keep both on the path during the trial, so a rollback needs no reinstall. Pin the OpenTofu version your team tests against, because the project's FAQ states that compatibility with future Terraform releases is not guaranteed. OpenTofu v1.13.1 was released on October 1, 2026, so check whether a newer patch exists before you choose. Document both version numbers in the runbook and name the owner who decides when the trial ends. Terraform stays installed until the team signs off.

Initialize and verify the plan

Run tofu init and then tofu plan against each environment's existing state, and treat every change you cannot explain as a blocker. A clean migration should show no creates, updates or deletes caused by the switch itself. Look closely at provider version changes, rewritten lock files and backend settings that init updates. Compare the OpenTofu plan with a Terraform plan taken from the same commit, and save both for review by the team that owns the stack. Zero unexpected changes is the pass condition for this step.

Test with a small change

Make one low-risk change, such as a tag on a non-critical resource, and apply it through OpenTofu. This confirms that the write path, state locking and the backend behave as they did under Terraform. Before the trial, check the OpenTofu migration documentation on whether state written by OpenTofu can be read by Terraform again, because that decides whether rollback is a simple tool swap or needs a restore from the first card's backup. Keep the apply log, the state diff and the approver's name. One small, reversible apply should pass before routine changes move to OpenTofu.

Shared data through terraform_remote_state

The migration overview warns that configurations sharing data through the terraform_remote_state data source usually need extra care, and it links a separate guide for that case. Inventory every consumer that reads another stack's outputs, and list which stacks depend on each output. Agree the migration order with the owners of each producer and consumer stack, then compare output values before and after each move. Confirm the current location of the separate guide from the overview, since it sets the detailed steps. Producer and consumer order matters more here than in any single stack.

State encryption after the move

State and plan encryption is optional, and it fits after the migration is complete. OpenTofu encrypts state and plan files at rest for local storage and remote backends, with key providers including PBKDF2, AWS KMS, GCP KMS, OpenBao and Azure Vault, a feature introduced in v1.7. Agree the key provider with your security team, because lost keys can leave state unreadable. Test decryption on a copy of the state before you enable it on production stacks. Key ownership should be documented before the first encrypted write.

Encryption docs

How the migration phases connect

This decision path starts with an inventory of configurations, state backends, providers and modules. Teams then back up state and code before installing OpenTofu, initializing the configuration and verifying that it reads the same state. A pilot on a non-production stack tests one small change end to end. Only after the pilot passes should both tools plan the same code in a parallel run, with plan and output differences reviewed closely. CI and runner cutover comes next, and Terraform is decommissioned only after the rollback window closes. A failed verification or pilot sends the team back to the backup step, with the inventory revisited.

Decision path for the migration, with failed checks returning to backup.

Sequence: inventory, pilot, parallel run and cutover

This sequence moves an existing Terraform estate to OpenTofu without changing live infrastructure until each stack has been checked. Each step leaves a record, from the inventory and verified backups through a clean plan, a parallel comparison and cutover, so the rollback path stays open until the team decides to close it.

  1. Inventory state, backends, pins and consumers

    The team lists every state file, backend, provider and module version pin, along with each terraform_remote_state consumer that reads another stack's outputs. OpenTofu's migration overview flags these data sharing setups for extra care, so the team should map them first. It also records CI jobs, runners and any HCP Terraform features in use, such as workspaces, variable sets or policies. Each HCP Terraform feature needs a named replacement or an explicit decision to drop it, because the HCP Terraform service is not part of OpenTofu. The step is done when the inventory is signed off and every consumer has an owner.

  2. Back up state and code, then test restores

    The platform owner copies every state file from each backend, along with the code, lock files and variable inputs, and stores the copies where Terraform runs cannot overwrite them. A backup only counts once it can be read, so someone outside the migration team opens a sample of archived state with Terraform and confirms the resources it lists match the live environment. Encryption keys and backup access rules are documented next to the archive. The step closes when every backup has been read successfully and the restore results are filed with the change record.

  3. Install OpenTofu and confirm a clean plan

    Engineers install OpenTofu on a workstation or runner image, initialize each configuration against its existing backend, and run a plan without applying anything. Any change the plan proposes that the team did not expect is investigated before the next step, including provider version differences and changes caused by backend or state settings. If state encryption is enabled, confirm that every runner can reach the key provider. Pin the OpenTofu version in the repository. The step is done when each stack shows no unexpected changes and the reviewed plan output is stored with the migration record.

  4. Pilot a small change on a non-production stack

    The team picks one low-risk, non-production stack and makes a small, reversible change through OpenTofu, such as a tag update or one non-critical attribute. The change goes through the normal review and apply path. Afterwards the team checks the resulting state, the outputs and any downstream consumers that read them. Illustrative example: a tag update on a test network stack. The pilot is done when the change applies, the state reads back correctly and every gap the team found is written down with an owner.

  5. Run both tools in parallel on shared code

    For the agreed period, Terraform and OpenTofu both plan the same code against non-production state, and the results are compared on criteria the team set in advance. Useful criteria include plan differences, provider and module resolution, error messages and CI failures. Only one tool should apply changes to a given state during this period. Set the parallel run length and the comparison criteria in the written scope before work starts. Each mismatch is logged with an owner and a fix. The step is done when the comparison log has no open differences that block cutover.

  6. Cut over CI and runners to OpenTofu

    The team changes CI jobs, runner images and wrapper scripts so the pipeline calls the tofu binary, and updates pinned versions and secret references. The Terraform path stays available for the rollback window. Pipeline owners confirm that state locking, approval gates and audit logs still behave as before. Any Terraform-only feature found in the inventory is either replaced or formally left out of scope. The step is done when a production change runs end to end through OpenTofu and the pipeline record shows the expected approvals.

  7. Decommission Terraform after the rollback window

    When the rollback window agreed in the written scope closes, the team removes Terraform from runners and pipelines. Final state and code backups are archived with checksums and restore notes, and access to the archive is restricted and reviewed. The retention period follows the organization's own records policy, so confirm it with the compliance lead before archiving. The step is done when Terraform is no longer installed in any pipeline, the archives can be read and the platform owner signs the decommission record.

Where shared state and version pins need extra care

Start with any configuration that reads another stack's outputs through the terraform_remote_state data source. The OpenTofu migration overview warns that these configurations typically need additional care, and a separate guide covers that case, so read it before you move anything. The safe order is usually to migrate the producer stacks that own the outputs first, confirm their state still loads and their outputs are unchanged, then move the consumers. Illustrative example: if a networking stack publishes VPC IDs that an application stack reads, cut over the networking stack first, compare its outputs, and only then switch the application stack's pipeline.

Version pins are the second place where two tools can end up writing the same state. CI images, runner tooling and any pinned Terraform binary in a wrapper script must change in the same change set, so no stack is applied by Terraform in one job and by OpenTofu in the next. Search for required_version in modules, for version variables in pipeline definitions, and for runner images that bundle a binary. Working directories initialized by one binary can also carry state that the other binary should not touch. Ask your runner or image maintainers how pinned images are rebuilt, because one stale agent pool is enough to apply a stack with the wrong binary.

Finally, plan for the compatibility limit. The OpenTofu FAQ states an aim of feature parity with Terraform, but compatibility with future Terraform releases is not guaranteed, so a Terraform upgrade cannot be assumed safe for OpenTofu. If you need to track Terraform for any stack, keep a fallback Terraform version pinned, test it against your own state and modules, and document how to revert to it. Review the Terraform releases page before choosing that version. The migration overview describes the process as safe and reversible, which only holds if state and code were backed up before the first apply.

Terraform to OpenTofu migration effort: what drives it

This table lists the drivers that change how much work a Terraform to OpenTofu move takes, what pushes each one up, what keeps it down and what to request in a written quote. Read each row against your own estate before you estimate scope. OpenTofu is MPL 2.0 licensed, so the main cost is labor, testing and any paid services you keep, and ongoing upgrades can sit under a retainer.

DriverWhat raises effortWhat lowers itWhat to ask for in a quote
Number of state files and backendsMany state files, several backends, or mixed local and remote state that each need a verified copy and rollback point.One backend type, few state files, and a documented state inventory with an owner for each workspace.Count of state files per backend, the backup method, and how each backup is verified before cutover.
terraform_remote_state useStacks that read outputs from other state files, so cutover order and every consumer must be mapped first.Outputs moved to a shared contract, or consumers migrated in one planned window with their producers.Inventory of every terraform_remote_state consumer and the migration approach proposed for each one.
HCP Terraform-hosted featuresReliance on HCP Terraform runs, private registry or policy features that need a confirmed OpenTofu replacement.Little use of hosted features, or features already run through a self-hosted runner that you control.Written list of each hosted feature in use, with the replacement, owner and cutover plan for it.
Provider and module count and version pinsMany providers and modules pinned to Terraform-era versions that must be checked against OpenTofu before cutover.Current version pins, a short provider list, and modules already verified to initialize under OpenTofu.Per-provider compatibility check, lock file handling plan, and the test used to confirm each version resolves.
CI and runner integrationPipelines with a hard-coded Terraform binary, custom runner images, plan artifacts or policy hooks tied to the CLI.The binary set at one shared point, and a pipeline already tested against a non-production workspace.List of pipeline stages and runners touched, and how plan output and state access are tested before production.
Test coverage and team familiarityThin plan-diff testing, no pre-change baseline, and engineers new to OpenTofu state and plan handling.Automated plan diffs on each workspace, and staff who have already run a small test change in OpenTofu.Baseline plan output for each workspace, the test change plan, and who on the team signs off each result.
Change-record evidence for auditors and reviewersChange tickets, approvals and state history kept outside the code repository, or not kept at all.Each migration step tied to a versioned change record with plan output, approver and rollback notes.Evidence template covering backups, plan diffs, approvals and rollback steps, and who keeps the records.
Upgrades after cutoverStaying current with OpenTofu releases, since compatibility with future Terraform releases is not guaranteed.A scheduled upgrade cadence with tests on each release, or a retainer that covers upgrades and continuous testing.Whether upgrades, testing and handover sit in a retainer, and the scope and notice terms in writing.

What usually goes wrong in a Terraform to OpenTofu move

The failures below share a pattern: a change to tooling, state or versions reaches some consumers but not others. Each card names one failure and the check to run before cutover, and the checks map onto the back up, verify and small-change test steps in OpenTofu's migration path.

Plan drift from version changes

A plan that differs from the last Terraform plan is the first sign of trouble. Provider and module versions can resolve differently when the same code runs under OpenTofu, so the diff may show changes nobody made. Before cutover, run tofu plan against a copy of production state, pin provider and module versions explicitly, and treat any unexpected create or replace as a stop condition until someone explains it.

Shared state breaks mid-cutover

Configurations that read another stack's outputs through terraform_remote_state need extra care, because the consumer may point at state that is being rewritten. Identify every consumer that reads your state, then move producers and consumers in one agreed window or keep the old state readable until each consumer is switched. Record the order of moves in writing so a half-migrated stack does not fail silently for a team that never saw the change.

Migration overview

CI still calling Terraform

A pipeline that still runs the terraform binary can plan or apply against the same backend while a teammate's job writes OpenTofu state. Once OpenTofu has written state, the old binary may fail or behave differently, and the two tools can disagree about what exists. Before cutover, search every pipeline, runner image, Makefile and wrapper script for terraform calls, disable scheduled runs, and freeze applies until one tool owns each state file.

Unverified or unreadable state backup

A state backup only counts if you can restore from it and read it with the tooling you will run next. Copy the state and configuration before installing OpenTofu, then confirm the copy with a restore into a scratch workspace and a plan that shows no changes. If state encryption is enabled, confirm that the key provider can decrypt the backup, because a backup that only exists encrypted under a key you cannot reach is not a backup.

State encryption docs

Assuming future Terraform features arrive

OpenTofu aims for feature parity with Terraform, but it does not guarantee compatibility with future Terraform releases, and the community decides which features it adopts. Any feature your team planned to rely on from a later Terraform release should be treated as unverified until you test it in OpenTofu. Review release notes for each OpenTofu upgrade, and keep a list of the language and provider features your code depends on so each upgrade has a test list.

OpenTofu website

HCP Terraform features assumed portable

Teams often assume that anything they run in HCP Terraform, such as workspace policy, run triggers, private registry use or team access settings, has a matching OpenTofu feature. Confirm each one against OpenTofu's documentation and your own runner before cutover, and list any feature with no confirmed replacement as a migration blocker. Where no equivalent is confirmed, plan the replacement in your CI or runner layer and test it before the first production apply.

How much effort does a Terraform to OpenTofu migration need?

Do we need to rewrite our HCL when moving to OpenTofu?

Usually no. OpenTofu describes itself as a drop-in replacement for Terraform that preserves existing workflows and configurations, so most HCL carries over unchanged. The check that matters is behavioral: run initialization and a plan against a copy of each stack, and confirm the plan shows no unexpected changes before any apply. Pay closer attention to configurations that read other stacks through the terraform_remote_state data source, since the OpenTofu migration guide flags them as needing additional care. Features added after the fork, such as early evaluation of variables and locals in v1.8 and provider for_each in v1.9, are optional, so adopt them only after the migration is stable. Also check any pipeline steps that call the terraform binary directly.

How long does a Terraform to OpenTofu migration take?

The timeline depends on the drivers below, and the schedule is agreed in writing as part of the fixed scope before work starts. The biggest drivers are the number of state files and workspaces, the number of backends and cloud accounts they span, and how many CI pipelines and runners call Terraform. Stacks that share outputs through terraform_remote_state need sequenced cutovers, so their dependency graph sets the order. Test coverage matters too: a stack with an automated plan and apply test suite can be verified faster than one with no tests, which needs manual review. Change freeze windows, approval cycles and maintenance periods also shape the calendar. Ask any provider, including DeployOpen, to break the schedule down by driver against your inventory.

What does the migration need from our team?

Four things should be in place before work starts: access, owners, approvers and a place to test. First, someone needs read and write access to every state backend, plus the ability to take and restore state backups. Second, each CI pipeline and runner needs an owner who can change the binary version and the job definitions. Third, change approvers need to sign off on the cutover window and the rollback plan for each stack. Fourth, a test environment should hold copies of state and configuration, so the team can run plans and review the differences before production changes reach live systems. Much of the effort is usually reviewing plans and coordinating cutovers with teams that depend on shared outputs. The headcount depends on your stack count and on who already knows the backends well.

Can our own engineers run the migration without a partner?

Yes, if your team has the skills and the test coverage to verify each stack. OpenTofu's migration overview gives four steps: back up state and code, install OpenTofu, initialize and verify the configuration, and then test with a small change. The overview describes the process as designed to be safe and reversible, which makes it a workable plan for an in-house team. The skills that matter are Terraform state handling, backend administration, CI changes and close reading of plan output. Without automated tests, the verify step becomes a manual review of every plan, which is often where outside help adds the most value. An implementation partner can take the work under a fixed scope, or review your own plan and runbook, and you can choose either path once the scope is written down.

How is an implementation partner priced for this work?

Work is priced against a fixed scope that you and the partner agree in writing before anything starts. DeployOpen does not publish a price list, so a quote follows from that written scope. The scope should list the inventory of stacks and backends, state backup and verification, pipeline and runner changes, test runs, cutover support, documentation and handover. Be clear which items are one-time and which recur: the migration itself is one-time work, while ongoing support, upgrades and continuous testing are separate retainers that recur. Cost rises with stack count, backend variety, the number of cutover windows, and how much of the test suite must be written first. To compare quotes, ask each provider for the deliverables, the named exclusions, who performs each task, the change-control steps, and what happens if a stack needs a second cutover window.

Can we reverse the move to OpenTofu if it goes wrong?

Yes, provided Terraform stays installed and you have verified state backups. The documented migration process is designed to be reversible, and a rollback depends on the Terraform binary still being available to run against the same state. Before the first cutover, take a state backup for every stack, store it outside the backend being changed, and confirm you can restore it in the test environment. If you enable OpenTofu state encryption, keep the key material in the backup plan too, because a backup without its keys cannot be restored. Then confirm with OpenTofu's documentation whether state written by OpenTofu can be read by Terraform after an apply, since that determines how far back a rollback can go. Keep the rollback steps in the change record so approvers can review them before the window opens.

Will OpenTofu stay compatible with future Terraform releases?

Not guaranteed. The OpenTofu FAQ states an aim of keeping feature parity with Terraform, but the community decides which features OpenTofu adopts, so the two projects can diverge over time. Terraform v1.16.6 was released on October 14, 2026, with v1.17.0 in release candidates, and OpenTofu v1.13.1 was released on October 1, 2026, so each project ships on its own schedule. Plan for divergence by pinning the OpenTofu version in each pipeline, testing provider and module upgrades in the test environment, and reading the OpenTofu project release notes before each upgrade. If you later need to return to Terraform, check the features you rely on against the Terraform release you would run. If you expect to track both projects, ask the partner to include upgrade testing in the written scope.

How DeployOpen scopes and delivers a Terraform to OpenTofu migration

Most DeployOpen engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. For a Terraform to OpenTofu move, that means the work covers state backends, CI runners and code inside your own infrastructure. The result is documented and handed over so your platform team can operate it.

How we scope

  • The written scope lists every root module, workspace, state backend and provider version in the migration.
  • It names the CI runners, policy checks and secrets paths that call Terraform today, so they are covered.
  • Configurations reading other stacks through terraform_remote_state get a separate scope item, since OpenTofu's guide flags them.

How we build

  • Backups of state and code are taken and verified before any binary is installed or any configuration is changed.
  • OpenTofu is installed, initialized and checked against the existing configuration, following the four-step path in OpenTofu's migration overview.
  • Each environment is tested with a small change in a non-production workspace before any production plan runs.

How we hand over

  • Handover includes migration notes recording every change made to code, state handling and pipelines during the move.
  • Rollback steps for each environment, built on the backups taken before cutover.
  • Your team receives the code and documentation listed in the written scope, so it can operate the result.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers that can follow the fixed-scope migration.
  • Retainers can cover OpenTofu version upgrades, since compatibility with future Terraform releases is not guaranteed.
  • Ask how upgrade testing and escalation are defined in any retainer before signing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.