OpenTofu in 2026: beyond the Terraform fork

For my first tofu plan, I’d pick a Terraform workspace where I expect no changes. I’d back up its state and run both tools against it with the same provider versions and inputs. If Terraform leaves an Azure VM alone and OpenTofu wants to replace it, that’s the first difference I’d investigate.

In my October comparison of Bicep and Terraform, I recommended keeping a working infrastructure standard unless there’s a reason to change. Encrypted saved plans are one reason I’d test OpenTofu: the local lab below encrypts a plan and applies it without provisioning cloud infrastructure.

As of November 26, 2026, OpenTofu 1.13.10 (released November 23) is the latest stable version. This patch updates the Go toolchain to address a security advisory. Built-in linting and symbol libraries remain experimental.

How OpenTofu works

OpenTofu is an open-source infrastructure-as-code engine. You describe the desired infrastructure in HCL, providers communicate with the relevant APIs, and the engine calculates and applies changes. State connects the resource addresses in your configuration to the objects it manages.

If you know Terraform, the working model is familiar:

tofu init
tofu fmt -check
tofu validate
tofu plan

init prepares dependencies and the backend. validate checks the configuration, but does not prove that your credentials, permissions, or proposed infrastructure changes will work. plan is where you review the proposed changes before applying them.

The project started in response to HashiCorp’s 2023 licensing change. OpenTofu uses the Mozilla Public License 2.0, and its technical charter establishes it under LF Projects, within the Linux Foundation ecosystem.

A Technical Steering Committee oversees OpenTofu. The technical charter’s voting rules limit how much voting power members who work for the same company can hold between them.

What the licenses allow

Modern Terraform releases use the Business Source License 1.1. A team running Terraform against its own infrastructure falls under internal use, which the additional use grant excludes from its definition of a competitive offering. The restriction concerns offering the software to third parties on a hosted or embedded basis to compete with the licensor’s paid offerings.

Each Terraform release has its own four-year clock before its license changes to MPL 2.0.

If you sell a platform that embeds Terraform, have counsel review how the grant applies to your product.

Why I would choose OpenTofu

These are the cases that would make me pilot it:

  • Encrypt state and saved plans when configured. OpenTofu encrypts them in the CLI; state and plan encryption are separate settings. Someone who can retrieve an encrypted artifact still needs the key to read it. You take on key access and recovery, too.
  • Use variables in backend configuration. OpenTofu’s early evaluation supports early-known values in backend configuration. Terraform still requires static values inside the backend block, although you can supply partial configuration with -backend-config.
  • Manage provider instances dynamically in standard HCL configurations. OpenTofu’s provider for_each can replace hand-maintained aliases when configuring AzureRM for several Azure subscriptions. Removing resources still requires care; the provider configuration must remain available until those resources are gone. Terraform Stacks has its own provider for_each for component configurations.
  • Meet a specific licensing or governance requirement. OpenTofu’s MPL 2.0 license and LF Projects governance may fit a requirement that Terraform’s BSL does not. Terraform’s grant permits internal use, so that distinction matters most when your legal or product requirements call for it.

Where Terraform compatibility needs checking

You do not need to rename all your files or rewrite your modules just to evaluate OpenTofu.

Area What to expect
Configuration Existing .tf files and terraform {} blocks remain valid starting points.
Providers OpenTofu uses the provider ecosystem, with its own default registry at registry.opentofu.org. Verify your exact dependencies.
State The migration documentation describes reading Terraform state, but that alone does not establish compatibility with every language feature or workflow.
Automation The CLI is familiar; scripts, runner images, credentials, caches, policy checks, and hosted execution still need testing.
New features OpenTofu-specific syntax and encrypted state introduce additional constraints on returning to Terraform.

The provider requirements documentation explains the registry distinction: a source such as hashicorp/azurerm defaults to the OpenTofu registry when interpreted by OpenTofu. An explicitly configured hostname deserves separate review, as do private registries and mirrors.

Two official OpenTofu pages describe the compatibility scope differently: the FAQ says OpenTofu works with state files created by Terraform 1.5.x or older; the 1.13 interdependent-configuration guide describes reading Terraform 1.x state. Neither statement promises that every recent Terraform feature works unchanged.

For example, Terraform 1.16 added support for import blocks inside child modules. OpenTofu 1.13.9 still restricts import blocks to the root module (source). Inventory features like this, then test the actual combination of CLI version, configuration, providers, backend, and state.

If you use HCP Terraform or Terraform Enterprise, inventory the services around the CLI. You still need somewhere to run jobs, enforce policies, serve private modules, and administer workspaces if you rely on those features.

The features worth evaluating

State encryption, sensitive values, and ephemeral values

State can contain credentials and other confidential resource attributes. Marking an output sensitive = true does not, by itself, remove that information from state.

OpenTofu introduced native state and plan encryption in version 1.7. Encryption happens in the CLI, so the stored artifact can remain encrypted whether it is saved locally or sent to a backend.

For Azure, the azurerm backend stores state in an Azure Blob Storage container and supports state locking. Azure Storage encrypts data at rest and decrypts it transparently for authorized reads. If you also enable OpenTofu state encryption, someone who downloads the blob still needs the OpenTofu encryption key to read the state.

There are three complementary controls:

Control What it does Important limit
sensitive = true Redacts values in normal human-readable output. Does not itself keep them out of state or plan files.
Ephemeral values Keep supported values out of persisted state and plans. They can only flow into contexts that accept ephemeral values.
State and plan encryption Protects persisted artifacts at rest. An authorized process with the key can still decrypt them.

Ephemeral resources and write-only attributes arrived in OpenTofu 1.11. Check whether your provider implements them for the resources and attributes you use. The 1.13 documentation says the concept aims for compatibility with Terraform’s ephemeral values.

My preference is to avoid persisting a secret where the provider and workflow allow it. Encrypt the sensitive data that still needs to be stored, and retain output redaction.

The 1.13 encryption documentation also sets clear boundaries: encryption does not prevent data loss, replay of an older artifact, or access by the person running the authorized command. Key recovery, state backups, access controls, and locking remain necessary.

For existing state, follow the documented transition: configure an unencrypted fallback so OpenTofu can read the old snapshot, rewrite the state with encryption, then remove the fallback and enforce encryption.

Provider iteration removes repetitive configuration

If you maintain an AzureRM provider block per Azure subscription, most of those blocks probably look alike. Since OpenTofu 1.9, you can put for_each on one aliased provider block and set subscription_id for each instance. A resource group in each subscription can then select its provider with provider = azurerm.by_subscription[each.key]. Terraform offers provider for_each in Stacks component configurations; this OpenTofu feature applies to standard .tf configurations.

Give resources a separate, filtered for_each collection, typically a subset of the provider instances. OpenTofu may warn if the provider and resource use the same for_each expression; the important constraint is that a provider instance must remain available while state-tracked resources still use it. In this example, subscriptions maps stable keys to subscription IDs, while active_subscriptions selects which subscriptions currently have resources. For example:

variable "subscriptions" {
  type = map(string)
}

variable "active_subscriptions" {
  type = set(string)
}

provider "azurerm" {
  alias           = "by_subscription"
  for_each        = var.subscriptions
  subscription_id = each.value
  features {}
}

resource "azurerm_resource_group" "this" {
  for_each = {
    for key, subscription_id in var.subscriptions :
    key => subscription_id if contains(var.active_subscriptions, key)
  }

  provider = azurerm.by_subscription[each.key]

  name     = "rg-${each.key}"
  location = "westeurope"
}

When retiring a subscription, remove it from active_subscriptions and apply first. Once its resources are gone from state, remove it from subscriptions. The 1.13 provider guide explains this ordering.

Early evaluation and optional .tofu files

OpenTofu 1.8 added early evaluation, allowing variables and locals in places such as module sources and backend configuration. Terraform 1.15 later added variables and locals in module sources and versions; input variables used there must be marked const = true. Terraform backend blocks still cannot refer to named values.

This can reduce wrapper scripts and generated configuration. It does not make initialization depend on resources that have not been created yet: the relevant values must be available early, before the state or provider operations they would otherwise depend on.

The same release added .tofu files. According to the 1.13 file precedence rules, if both main.tf and main.tofu exist, OpenTofu loads main.tofu and ignores main.tf.

That precedence applies to the whole file. If you override one resource in main.tofu, any other blocks you still need from main.tf must be present somewhere OpenTofu will load them. I’d keep the existing .tf files for the first migration.

Distribution and everyday workflow improvements

If you already operate a container registry, you can use it to distribute modules and providers through the OCI support added in OpenTofu 1.10. For an air-gapped runner, you still need to publish or mirror every dependency it needs and give it access to the registry.

Version 1.12 brought several less conspicuous improvements:

  • More complete provider checksums during initialization. With direct installation from the OpenTofu registry, init can populate the cross-platform hashes needed by caches and mirrors.
  • -json-into=FILENAME. Commands supporting it can retain human-readable terminal output while writing machine-readable output separately.
  • Dynamic prevent_destroy. A module can make deletion protection depend on an input variable. While the rule is present and evaluates to true, OpenTofu rejects a plan that would destroy the resource.
  • lifecycle.destroy = false. OpenTofu added this literal-boolean setting in 1.12; Terraform added it in 1.16. Apply false while the resource block still exists so the setting is recorded in state. Later, if the resource is removed or needs replacement, OpenTofu forgets the old instance instead of destroying it; for a replacement, it then creates a new instance. Confirm the plan says forget before applying. The old infrastructure keeps running, and you’re still responsible for it even though that state no longer tracks it. The cloud provider will still remember to send the bill.

What 1.13 adds, and what is still experimental

OpenTofu 1.13 adds convert and the assume... family of functions to help the planner reason about otherwise unknown values. Terraform 1.15 also added convert, so I would not choose OpenTofu for that function alone.

For example, a module can express that an unknown value will not be null. That can let OpenTofu evaluate a conditional during planning. If the value turns out to be null, the apply can fail.

The same release includes experimental built-in linting and symbol libraries. Symbol libraries explore sharing values, functions, and type aliases independently of resource-oriented modules. Both are worth following, but I would not build a production dependency on their current experimental interfaces.

Two upgrade notes are worth checking against your configuration: 1.13 removes WinRM provisioner support, and base64gzip produces different compressed bytes. If a resource uses that output, look for a diff in its plan.

The 1.13 series is scheduled to receive security support until August 2027.

Try it locally, without a cloud account

I tested this with OpenTofu 1.13.10. You’ll encrypt a local state file and a saved plan, then try to destroy a protected resource. Everything runs locally: the built-in terraform_data resource creates a state entry without downloading a provider or provisioning anything in the cloud.

Install OpenTofu using the official instructions. OpenTofu 1.13 requires macOS 13 Ventura or later. On macOS, the Homebrew route is:

brew install opentofu
tofu version

The lab was tested with OpenTofu 1.13.10. Create a new, disposable directory, outside your infrastructure repositories. Put the following in versions.tofu to declare the OpenTofu version range:

language {
  compatible_with {
    opentofu = "~> 1.13.0"
  }
}

This compatibility setting requires OpenTofu 1.12 or later. Keep the CLI pinned to the exact reviewed version in CI as well. A required_version in a .tf file is for Terraform; for cross-compatible modules, OpenTofu recommends separate version files. See the version and compatibility settings.

Put this in main.tf:

terraform {
  encryption {
    key_provider "pbkdf2" "lab" {
      passphrase = var.state_passphrase
    }

    method "aes_gcm" "lab" {
      keys = key_provider.pbkdf2.lab
    }

    state {
      method   = method.aes_gcm.lab
      enforced = true
    }

    plan {
      method   = method.aes_gcm.lab
      enforced = true
    }
  }
}

variable "state_passphrase" {
  type      = string
  sensitive = true
  ephemeral = true
}

variable "protect" {
  type    = bool
  default = true
}

resource "terraform_data" "example" {
  input = {
    purpose = "opentofu-local-lab"
  }

  lifecycle {
    prevent_destroy = var.protect
  }
}

For this disposable exercise, generate a passphrase in your shell and keep that same shell open through cleanup. Run the export only once. Regenerating the passphrase or losing it means losing access to these encrypted artifacts.

export TF_VAR_state_passphrase="$(openssl rand -hex 32)"

tofu init
tofu fmt -check
tofu validate
tofu plan -out=lab.tfplan
tofu show -plan=lab.tfplan

Review the plan, then apply the saved artifact:

tofu apply lab.tfplan
tofu plan

Applying a saved plan does not ask for another approval. In this lab, the first plan should contain one creation. After applying, the next plan should report:

No changes. Your infrastructure matches the configuration.

The local terraform.tfstate and saved lab.tfplan are encrypted. The ephemeral variable prevents the passphrase from being retained as an ordinary saved-plan input; the same passphrase must still be supplied to subsequent commands.

Now test the protection:

tofu plan -destroy

This is an intentional failure. With protect = true, OpenTofu should reject the plan with:

Error: Resource instance cannot be destroyed

Finally, explicitly disable protection for a cleanup plan, review it, and apply it:

tofu plan -destroy -var='protect=false' -out=cleanup.tfplan
tofu show -plan=cleanup.tfplan
tofu apply cleanup.tfplan && unset TF_VAR_state_passphrase

After successful cleanup, remove the disposable directory and its generated artifacts. This shell-only key approach is intentionally limited to the lab. For durable state, use managed key access or a securely stored passphrase, and test recovery before relying on it.

Watch what goes into your CI logs. An authorized tofu show -json can print sensitive values in plaintext even when the input file is encrypted. tofu state pull also outputs the raw state to stdout. Restrict access to any exports or logs that contain those values.

A migration workflow I would use

The 1.13 migration guide covers a single configuration. On a shared workspace, I’d start by finding every job that can write to its state.

1. Inventory the whole execution path

Record the Terraform version, provider versions, module revisions, backend settings, workspaces, and the CI jobs that can write state.

Include private registries, credential acquisition, policy checks, and anything consuming plan JSON. For a hosted Terraform workflow, establish the replacement execution and state arrangement before attempting a CLI cutover.

If configurations share outputs through terraform_remote_state, map which configurations read each state. Migrate from consumers toward the configurations whose state they read, starting with a leaf configuration that has no dependents. Do not cut over a producer first.

Check version constraints too. A required_version in a .tf file is a Terraform constraint, not an OpenTofu version guard. For a module supporting both tools, keep the Terraform constraint in versions.tf and declare OpenTofu compatibility in versions.tofu (using language.compatible_with on OpenTofu 1.12 or later). See OpenTofu’s compatibility guidance. Terraform and OpenTofu version numbers are not interchangeable feature-level labels.

2. Back up and establish a baseline

Schedule a migration window with no competing applies. Back up the code and state using the backend’s recovery facilities, and confirm that you can restore the correct snapshot. Protect state backups as secrets and keep them out of Git.

Run a baseline with the current engine, using the same workspace, credentials, and variable inputs you will use for the OpenTofu comparison:

terraform init
terraform plan -out=terraform-baseline.tfplan
terraform show terraform-baseline.tfplan

Treat saved plan files as sensitive artifacts: they can contain sensitive values, and plan files also capture backend configuration. Do not commit them or store them in broadly accessible CI artifacts; remove them when review is complete. Apply the same handling to opentofu-migration.tfplan below, especially if it is uploaded from CI.

For the first pilot, I would choose a configuration whose expected plan is empty. Investigate existing drift before the cutover so that it does not get confused with a migration difference.

3. Change the engine without upgrading everything else

Keep the backend, provider versions, and module revisions unchanged. Do not combine this with an init -upgrade, a backend relocation, a module refactor, or enabling encryption.

Retain the dependency lock file and review any initialization changes rather than deleting it to make errors disappear. Registry addresses, checksums, and newer Terraform-only language features such as child-module import blocks deserve inspection.

tofu init
tofu validate
tofu plan -out=opentofu-migration.tfplan
tofu show -plan=opentofu-migration.tfplan

Compare resource actions and root output values in the two plans. If Terraform leaves a resource alone and OpenTofu wants to replace or delete it, or if root outputs differ unexpectedly, stop and investigate. Check which state and provider OpenTofu selected before changing any configuration.

For automation, tofu plan -detailed-exitcode distinguishes an empty successful plan (0), an error (1), and a successful plan containing changes (2). Do not treat every nonzero exit as the same result.

4. Perform a controlled cutover

After reviewing the OpenTofu plan, apply that saved plan with OpenTofu. Do not reuse a plan generated by Terraform.

The migration guide notes that an apply can update state representation even without infrastructure changes. Keep the backup and migration controls in place. For the first cutover, use a non-production leaf configuration selected during inventory. After applying its reviewed plan, test one small, reversible change there.

Update all writers before normal operation resumes: developer instructions, CI images, scheduled jobs, and emergency runbooks. Backend locking helps serialize operations; it does not establish compatibility between two different engines writing the same state.

5. Verify cross-configuration state

If an application configuration reads Azure virtual network and subnet IDs from networking configuration through terraform_remote_state, there is a dependency beyond the individual repository.

The interdependent migration guide recommends migrating consumers first. In this example, migrate the application configuration before networking, then verify the application’s state reads after each step.

The application reads networking outputs throughout this two-configuration cutover:

flowchart TD
    accTitle: Migrate the state consumer before the producer
    accDescr: The application reads networking outputs through terraform_remote_state. Both configurations start on Terraform. Migrate the application to OpenTofu first and verify its state reads while networking remains on Terraform. Then migrate networking to OpenTofu and verify the application's state reads again.
    before["Before cutover<br/>Application: Terraform<br/>Networking: Terraform"]
    during["Consumer migrated<br/>Application: OpenTofu<br/>Networking: Terraform"]
    after["Both migrated<br/>Application: OpenTofu<br/>Networking: OpenTofu"]
    before -->|"1. Migrate application<br/>Verify state reads"| during
    during -->|"2. Migrate networking<br/>Verify state reads again"| after

This avoids leaving a Terraform consumer dependent on state newly written with OpenTofu-specific behavior. If you later add encryption, those consumers also need the appropriate decryption configuration and key access.

6. Treat rollback as a state operation

If OpenTofu has only read the state, there’s no OpenTofu state write to undo. After an apply, check what changed before restoring anything. Suppose the apply created an Azure VM: restoring yesterday’s state would leave the VM running with no entry for it in that snapshot. Stop all writers and reconcile the state with the actual resources before resuming.

I’d introduce encryption, provider iteration, or new syntax in separate changes. That way, if the first OpenTofu plan differs from the Terraform baseline, there are fewer places to look.

When I would choose OpenTofu

For a new HCL project that needs an open-source engine and client-side state encryption, I’d start with OpenTofu. For an existing Terraform deployment, I’d pick the workspace that needs the feature. If the team has to move hosted jobs or replace policy checks to run that workspace, I’d price that work into the decision first.

I’d also take the pre-commit hooks from my Terraform guardrails article through the pilot. Run the formatter, validator, linter, and scanner the way a contributor would. If a required check still invokes Terraform, or nobody has successfully restored a state backup, I’d hold off on moving the next workspace.

Sources and further reading

Written by

Hidde de Smet

I'm a Microsoft MVP (2026–2027), recognized for Azure Infrastructure as Code and Developer Tools, a certified Azure Solution Architect, and a Microsoft Certified Trainer. I help teams design and build cloud solutions with Azure, Infrastructure as Code, and DevOps. On this blog, I share practical guides and lessons learned on cloud architecture, AI, and developer tools—including GitHub Copilot, Terraform, and Bicep.

Start the conversation