Skip to content
New Atlanta
Topics

OpenTofu vs Terraform

Compare CLI licenses, state encryption and recovery steps before moving a Terraform workflow to OpenTofu.

Published 4 min read
OpenTofu license
MPL 2.0
Terraform license
BUSL 1.1
OpenTofu state protection
Optional CLI encryption
Terraform state protection
Backend-dependent

Decision guide

OpenTofu
Choose OpenTofu when your team wants the MPL-licensed CLI or needs to encrypt state and saved plans before they reach storage.
Terraform
Choose Terraform when your existing HCP Terraform workflow meets your controls and switching would require rebuilding a tested run and recovery process.
Deciding factor
Price the migration rehearsal, key recovery and state-reader changes against the operational requirement that prompted the switch.

Comparison matrix

OpenTofu can encrypt state before writing to storage. With Terraform, the choice of backend determines how stored state is protected.

CLI licensing, state handling and recovery responsibilities Verified
Decision factorOpenTofuTerraform
Project license MPL 2.0OpenTofu CLI source BUSL 1.1Terraform CLI 1.6+
At-rest protection Optional CLI encryptionState and saved plans Backend-dependentStored state
Recovery rehearsal Restore keys and state Restore backend snapshot

Which license applies to the CLI?

OpenTofu publishes its CLI under the Mozilla Public License. HashiCorp’s license for Terraform 1.6 and later identifies the Business Source License, an additional use grant and a change date.

Record the exact CLI release on the runner. If you redistribute the binary or package it into a hosted service, review that release’s license and use grant before committing to a distribution model. Provider plugins carry their own licenses.

Where is infrastructure state encrypted?

OpenTofu can encrypt state and saved plans before writing them to a local file or a remote backend. Terraform relies on the selected backend for state encryption at rest.

For an encrypted OpenTofu state, inventory both the people who can read the object and the identities that can decrypt it. For Terraform, check your backend’s encryption settings and the access policy on exported plans.

What changes for existing state readers?

A consumer of encrypted OpenTofu remote state needs a compatible decryption configuration and access to the correct key. Inventory those consumers before turning on enforcement.

How do you rehearse the migration?

An OpenTofu migration is ready to rehearse once you can recover the original state and reproduce the current Terraform plan. Use an isolated copy to test the CLI, provider versions and backend together.

Preserve the dependency lock file and record the CLI and backend settings. If the move also replaces hosted runs, compare Terraform Cloud alternatives for state storage, approval controls and execution records. Investigate unexpected changes on a read-only plan. Separately rehearse restoring state and key access before a production cutover.

Why keep other changes out of the rehearsal?

A simultaneous provider upgrade can change the plan before the CLI difference is understood. Keep provider selection fixed for this test so each unexpected change has a narrower cause.

Frequently asked questions

Does marking a Terraform variable sensitive encrypt the state?

No. The sensitive flag changes how Terraform displays a value. A stored value still needs protection from the state backend and its access controls.

Can OpenTofu recover encrypted state if the only key is lost?

OpenTofu cannot decrypt an encrypted state file without the key material required by its encryption configuration. Test recovery of both the state backup and its keys.

Methodology and sources

We compared the projects’ published CLI licenses, their documented storage boundaries and OpenTofu’s migration procedure. Managed-service subscription pricing and provider-specific plugin behavior are outside this comparison.

About Evan Pritchard
Infrastructure & Kubernetes Architecture Writer

Editorial pen name. Covers infrastructure as code, cluster upgrades and application runtime migrations.