
terraform binary for tofu — see the Migration Guide section below.Reviewed for accuracy by Ryan Fee on July 18th, 2025.
OpenTofu is the community-driven answer to Terraform's controversial licensing shift, offering infrastructure engineers a truly open-source alternative with
It addresses the concerns of terraform users while introducing innovations long requested by the community but never implemented in the original product.

In August 2023, HashiCorp changed Terraform's license from the Mozilla Public License v2.0 (MPL v2.0) to a restrictive Business Source License (BSL), prompting leading companies including Gruntwork, Spacelift, Harness, Env0, and Scalr to create OpenTofu as a fork of the last open-source version. This guide covers everything you need to know about OpenTofu in 2026.
OpenTofu's journey from a community manifesto to a CNCF project has been rapid:
for_each in import blocks, making bulk infrastructure imports much easier.for_each, and the resource exclusion flag.OpenTofu is a drop-in replacement for Terraform that preserves compatibility with existing configurations while adding significant enhancements. It functions as an Infrastructure as Code (IaC) tool that enables engineers to define infrastructure resources declaratively using HashiCorp Configuration Language (HCL).
OpenTofu uses human-readable configuration files to define infrastructure resources declaratively, allowing engineers to express their desired infrastructure state rather than writing procedural scripts. The tool builds a resource graph to determine dependencies and applies changes efficiently.
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "example-instance"
}
}A critical aspect of OpenTofu's functionality is state file management. The state file serves as the source of truth that maps configured resources to real-world infrastructure objects and tracks metadata. OpenTofu's state management approach offers several advantages:
With over 25,000 GitHub stars and more than 70 active contributors, OpenTofu has established itself as a vibrant open-source project. As a Linux Foundation project, OpenTofu is guided by a Technical Steering Committee representing multiple companies rather than being controlled by a single vendor. The CNCF accepted OpenTofu into its fold in April 2025, further solidifying its position in the cloud-native ecosystem.
Development priorities are shaped by:
While OpenTofu maintains compatibility with Terraform configurations, several key differences have emerged as the projects diverge. For larger architectural patterns, see our take on the Terraform & OpenTofu Terralith and understanding Terraform & OpenTofu workspaces.
OpenTofu: Uses the Mozilla Public License v2.0 (MPL v2.0), a true open-source license recognized by the Open Source Initiative. Users can freely use, modify, and distribute the software without ambiguity about competitive restrictions.
Terraform: Licensed under the Business Source License (BSL), a "source-available" license that prohibits using the software in ways that compete with HashiCorp's commercial offerings.
OpenTofu: Community-driven development under Linux Foundation's neutral governance. Development priorities are set through transparent RFCs and community voting.
Terraform: Controlled by HashiCorp (now IBM), with development priorities set by commercial interests.
OpenTofu has implemented several features long requested by the community but never added to Terraform:
| Feature | Description | Version |
|---|---|---|
| State file encryption | Protects sensitive infrastructure data at rest using multiple key providers | v1.7 |
| Early variable evaluation | Allows variables in previously restricted contexts like module sources | v1.8 |
| Provider iteration with for_each | Simplifies multi-region deployments with dynamic provider configurations | v1.9 |
| Exclusion flag | Enables selectively skipping resources during operations | v1.9 |
| Loopable import blocks | Use for_each/for loops in import blocks for bulk resource imports | v1.8 |
| OCI registry support | Package modules and providers using OCI format | v1.6 |
| OpenTelemetry integration | Experimental tracing support to improve performance | v1.10 |
OpenTofu supports both .tf and .tofu file extensions. When both exist with the same name, OpenTofu prioritizes the .tofu file, enabling module authors to provide OpenTofu-specific functionality while maintaining Terraform compatibility.
Migrating from Terraform to OpenTofu is designed to be straightforward. The migration process is a simple binary replacement in most cases. For the syntax-level details on what's the same and what's diverged, see the OpenTofu Language Guide.
Ensure your Terraform state is clean and there are no pending changes:
$ terraform plan
No changes. Your infrastructure matches the configuration.If there are changes, apply them before proceeding.
Always back up your terraform.tfstate file and any remote state before migration. This is critical and non-negotiable.
Install the OpenTofu CLI on your machine:
$ brew install opentofu
$ tofu --version
OpenTofu v1.10.0You can now use the tofu command as a drop-in replacement for terraform.
Run tofu init upgrade in your project directory. The upgrade flag ensures there are no conflicts with pulling providers from the OpenTofu registry:
$ tofu init upgrade
Initializing the backend...
Initializing provider plugins...Run tofu plan to ensure OpenTofu recognizes your existing infrastructure without planning unexpected changes:
$ tofu plan
No changes. Your infrastructure matches the configuration.Once confident, run tofu apply to update the state file to the OpenTofu format:
$ tofu apply
No changes. Your infrastructure matches the configuration.
Apply complete!Migrating from Terraform v1.5.x or lower: Migrate to OpenTofu v1.6.x first, then upgrade to the latest version. OpenTofu v1.6+ is fully compatible with Terraform v1.5.x.
Migrating from Terraform v1.6.x and newer: The migration is straightforward, but be aware of any new features or syntax introduced in later Terraform versions that may not yet be supported by OpenTofu.
registry.opentofu.org. If your configurations explicitly use registry.terraform.io, update them to use the OpenTofu registry.One of OpenTofu's most significant innovations is built-in state file encryption, a feature implemented in version 1.7. This addresses a longstanding security concern in the infrastructure as code community. For broader state management context (backends, locking, sharing), see our Terraform & OpenTofu state backends guide.
State files contain sensitive data including database passwords, API keys, and private IPs. While remote backends like S3 offer some protection, client-side encryption provides defense-in-depth security at rest.
OpenTofu supports multiple key provider options:
terraform {
encryption {
key_provider "pbkdf2" "mykey" {
passphrase = "secure-passphrase"
key_length = 32
iterations = 600000
}
method "aes_gcm" "default" {
key_provider = key_provider.pbkdf2.mykey
}
state {
method = method.aes_gcm.default
}
}
}You can also use AWS KMS, GCP KMS, or other external key management services for enterprise deployments.
Provider iteration using for_each (added in version 1.9) enables dynamic provider configurations, significantly reducing code duplication for multi-region deployments.
Instead of defining separate provider blocks for each region:
provider "aws" {
for_each = toset(var.regions)
alias = each.key
region = each.key
}
resource "aws_instance" "servers" {
for_each = {
for region in var.regions : region => {
instance_type = "t3.micro"
}
}
provider = aws[each.key]
ami = data.aws_ami.ubuntu[each.key].id
instance_type = each.value.instance_type
tags = {
Name = "server-${each.key}"
}
}This pattern eliminates repetitive code and makes configurations more maintainable.
OpenTofu allows backend configurations to use variables and locals, enabling dynamic backend selection based on environment:
terraform {
backend "s3" {
bucket = var.state_bucket
key = "${var.environment}/terraform.tfstate"
region = var.aws_region
encrypt = true
}
}This enables a single configuration to support multiple deployment environments without code duplication.
OpenTofu allows variables, locals, and data sources inside the top-level tofu block and for backend configurations—something Terraform traditionally restricts to static values. This unlocks powerful patterns:
locals {
environment = var.env
region = var.aws_region
}
terraform {
backend "s3" {
bucket = "tf-state-${local.environment}"
key = "${local.region}/terraform.tfstate"
}
}OpenTofu v1.10 introduced a native testing framework, eliminating the need for external test tools. The framework uses .tftest.hcl files:
run "validate_bucket_creation" {
command = apply
assert {
condition = aws_s3_bucket.main.id == "my-test-bucket"
error_message = "S3 bucket name does not match expected value"
}
}
run "validate_encryption_enabled" {
command = apply
assert {
condition = aws_s3_bucket_server_side_encryption_configuration.main.rules[0].apply_server_side_encryption_by_default[0].sse_algorithm == "AES256"
error_message = "S3 bucket encryption is not enabled"
}
}The test framework supports:
The exclude flag (v1.9) enables selectively skipping resources during operations. This complements the target flag by providing inverse selection logic:
# Apply all resources except database
tofu apply -exclude 'aws_db_instance.prod'
# Exclude multiple resources
tofu apply \
-exclude 'aws_db_instance.prod' \
-exclude 'aws_rds_cluster.analytics'Failed tofu apply operations can halt pipelines and cause frustration. Understanding common failure modes and debugging techniques is essential. For a deeper failure-mode catalog with worked examples, see our dedicated guide on debugging OpenTofu apply failures.
When credentials are invalid or expired, providers fail to authenticate:
Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
Resolution:
Provider errors occur when the provider cannot communicate with the target service:
Error: Failed to update instance: Service returned status 503 (Service Unavailable)
Resolution:
Invalid resource configurations fail during apply:
Error: Invalid or missing attribute: instance_type is required
Resolution:
tofu fmt -checktofu console to test variable valuesMultiple concurrent applies can corrupt state:
Error: Error acquiring the state lock
Resolution:
tofu force-unlock only as a last resort after verifying no other process holds the lockSet TF_LOG environment variable for detailed debugging:
export TF_LOG=DEBUG
tofu applyLog levels: TRACE, DEBUG, INFO, WARN, ERROR
Use tofu plan output to understand what will change:
tofu plan -json | jq '.resource_changes[] | select(.change.actions[] == "delete")'Use the -target flag to apply specific resources:
tofu apply -target 'aws_security_group.main'This isolates problems to specific resources.
Catch errors early with validation:
tofu validate
tofu fmt -recursive .Consult provider documentation for resource constraints:
tofu providers schema -json | jq '.provider_schemas | keys'OpenTofu supports the Language Server Protocol (LSP), enabling intelligent code completion, syntax highlighting, and error detection in modern text editors.
tofu plan{
"languages": {
"hcl": {
"command": "terraform-ls",
"args": ["serve"],
"initializationOptions": {
"backend": "memory",
"experimentalFeatures": {
"validateOnSave": true,
"refactoring": true
}
}
}
}
}OpenTofu maintains full compatibility with existing Terraform providers, ensuring access to thousands of infrastructure providers without modification.
Providers are declared in the required_providers block:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
}
}The OpenTofu Registry at registry.opentofu.org mirrors and extends the Terraform provider ecosystem. All major providers including AWS, Azure, GCP, Kubernetes, and 2000+ others are available.
As an open-source project, OpenTofu also supports community-maintained providers and modules, expanding beyond the HashiCorp provider ecosystem.
You can install OpenTofu by visiting the Installing OpenTofu page on the main OpenTofu site. Most users start with Homebrew on macOS (brew install opentofu), but packages are available for all operating systems. You can also test OpenTofu directly in Scalr, where you can select between Terraform and OpenTofu for any workspace.
At this time, there is no difference between the Terraform and OpenTofu commands other than calling tofu rather than terraform. The primary workflow commands remain the same: tofu init (prepare working directory), tofu plan (show changes required), tofu apply (create or update infrastructure), and tofu destroy (destroy infrastructure).
No. OpenTofu is compatible with all Terraform providers. There is a single provider format that both projects support. As a provider maintainer or author, you do not need to make any changes to your project, nor add additional tests. In the rare event that a provider works for Terraform but not for OpenTofu, the community addresses the issue promptly.
The OpenTofu community is committed to ensuring support for all Terraform providers short, mid, and long term. The Linux Foundation provides a strong framework for long-term project success, including the Technical Steering Committee and a requirement that projects have maintainers from many organizations to provide redundancy. There are already several dozen contributors, ensuring the project moves forward steadily.
The name was chosen to be easy to remember, short to type (just tofu in the CLI), and unique enough to be easily searchable. It was important to avoid confusion with Terraform in the market, which is why the original name "OpenTF" was changed at the advice of legal teams.
The community is encouraged to contribute by opening pull requests, reporting bugs, testing fixes, and participating in discussions in the public GitHub repository. You can also join the Slack community where core team members collaborate with the general community. The project is governed by a Technical Steering Committee that publishes meeting minutes publicly.
With the shift to OpenTofu, many organizations seek alternatives for collaborative infrastructure management.
Scalr: Offers comprehensive OpenTofu support with OPA integration, RBAC, custom hooks, and state management.
env0: Provides native OpenTofu support with advanced RBAC, secrets management, and policy enforcement. Founded by one of the original OpenTofu initiative members.
Spacelift: Delivers enterprise-grade features including multi-IaC workflows, Policy as Code, and self-service infrastructure through Blueprints.
For teams preferring self-hosted solutions:
OpenTofu continues evolving with regular releases. Current version is OpenTofu v1.10+, which includes:
The project maintains a transparent roadmap using GitHub milestones, allowing users to see and influence upcoming features.
For a quick command reference while applying these practices, see 10 OpenTofu commands. For pipeline integration patterns, see API-driven workflows for Terraform and OpenTofu.
Always encrypt sensitive state data:
terraform {
encryption {
key_provider "pbkdf2" "main" {
passphrase = var.encryption_passphrase
key_length = 32
iterations = 600000
}
method "aes_gcm" "default" {
key_provider = key_provider.pbkdf2.main
}
state {
method = method.aes_gcm.default
}
}
}Store state remotely with locking enabled:
terraform {
backend "s3" {
bucket = "opentofu-state"
key = "prod/terraform.tfstate"
region = "us-east-1"
encrypt = true
dynamodb_table = "opentofu-locks"
}
}Use version control and CI/CD to review changes:
# In CI/CD pipeline
tofu plan -json > plan.json
# Review plan in PR before applying
tofu apply plan.jsonOrganize code into reusable modules with clear interfaces:
├── modules/
│ ├── networking/
│ ├── compute/
│ └── database/
├── environments/
│ ├── dev/
│ ├── staging/
│ └── prod/
└── global/
Use OpenTofu's native test framework:
run "setup" {
command = apply
variables {
environment = "test"
}
}
run "validate_security_groups" {
command = plan
assert {
condition = length(aws_security_group.main.ingress) > 0
error_message = "Security group must have ingress rules"
}
}Utilize -exclude for phased rollouts:
# Phase 1: Non-critical resources
tofu apply \
-exclude 'aws_lambda_function.analytics' \
-exclude 'aws_cloudwatch_log_group.verbose'
# Phase 2: Critical resources (after verification)
tofu applyUse .tfvars files and environment separation:
# Development
tofu apply -var-file="dev.tfvars"
# Production
tofu apply -var-file="prod.tfvars"Enable tracing for performance analysis:
export OTEL_SDK_DISABLED=false
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
tofu applyThe OpenTofu community has established a clear trajectory for 2026 and beyond. The acceptance into the CNCF demonstrates institutional support and commitment to long-term stability. Development priorities include:
OpenTofu has successfully established itself as a powerful, community-driven alternative to Terraform. By maintaining compatibility with the existing Terraform ecosystem while introducing innovative features like state encryption, provider iteration, and native testing, OpenTofu offers infrastructure engineers both stability and progress.
The project's commitment to true open-source principles through the Mozilla Public License ensures users can deploy OpenTofu without concerns about licensing ambiguity. Its community-driven development approach means features that actually matter to practitioners take priority over commercial interests.
Whether you're a long-time Terraform user concerned about licensing changes, an organization seeking better security features, or a new infrastructure engineer building cloud infrastructure, OpenTofu provides a compelling option that combines mature infrastructure as code capabilities with open governance and continuous innovation.
The combination of CNCF membership, Linux Foundation governance, and an active developer community positions OpenTofu as the future of open-source infrastructure automation. Start your migration today and join the growing community of engineers building infrastructure the right way.
Last Updated: February 2026 OpenTofu Current Version: v1.10+ Terraform Compatibility: Full compatibility through v1.5.x and newer versions with feature parity
