Error - Could not copy link
Page link copied!
Blog

From Terraform to OpenTofu: A Migration Guide

OpenTofu emerged as the community's response fork of Terraform 1.5.x that maintains the MPL 2.0 license. It might be time to migrate - here's why

Daniel Caduri
January 19, 2026
~ min read
~0 min read

Terraform has gained popularity over the years and has solidified its position as one of the most used Infrastructure as Code (IaC) tools out there. SREs, DevOps, and cloud engineers have been relying on Hashicorp’s Terraform to create, maintain, and scale their infrastructure needs. In 2023, HashiCorp changed the licensing for all its products, including Terraform, from the open-source Mozilla Public License v2.0 (MPL 2.0) to the Business Source License v1.1 (BSL 1.1). This shift ended Terraform's nine-year history as a truly open-source project.

This change raised questions about future usage, commercial restrictions, and vendor lock-in. OpenTofu emerged as the community's response fork of Terraform 1.5.x that maintains the MPL 2.0 license and promises to remain open source forever. In this blog, we will look into OpenTofu, its similarities and differences with Terraform, and go over migration considerations and steps.

What is OpenTofu?

OpenTofu is an open-source IaC tool that is fully compatible with Terraform's configurations, providers, and state files. Born from the Terraform 1.5.x fork, OpenTofu joined the Linux Foundation in September 2023 and has been accepted at the Sandbox maturity level at the Cloud Native Computing Foundation (CNCF).

The tool maintains the same declarative configuration approach, provider ecosystem, and modular architecture that made Terraform popular. It works like Terraform, using providers to interact with cloud APIs, reusable modules for infrastructure patterns, and a state file to track resource lifecycles. Commands mirror Terraform in most cases, so simply replace `terraform` with `tofu`. 

OpenTofu offers 100% backwards compatibility with Terraform versions prior to 1.6. This means your existing code, modules, providers, and workflows work without modification. The migration is a straightforward binary swap in most cases.

What sets OpenTofu apart? It includes features the Terraform community has requested for years. OpenTofu 1.7 introduced built-in encryption for the state. OpenTofu 1.8 added early variable evaluation, allowing variables in backend configurations and module sources. OpenTofu 1.9 brought provider iteration with `for_each`, drastically simplifying multi-region deployments.​

The project has its own registry at search.opentofu.org, providing a centralized hub for discovering providers, modules, and resources. The registry UI offers well-documented components with examples, making it easy to find and reuse infrastructure code.​

Here are the most basic and useful OpenTofu commands:

  • tofu init – Initializes your working directory, downloads modules and providers
  • tofu plan – Creates an execution plan showing proposed infrastructure changes
  • tofu apply – Applies changes to your infrastructure resources
  • tofu destroy – Destroys all infrastructure resources defined in your configuration
  • tofu validate – Checks configuration validity
  • tofu show – Displays the current state
  • tofu state – Enables advanced state management operations

Why Consider Migration to OpenTofu?

Open-Source License: OpenTofu operates under the MPL 2.0 license, guaranteeing it remains truly open source. No single vendor can change the license again or restrict usage. The Linux Foundation governs the project, ensuring vendor neutrality and community-driven development.​

Community-Driven Development: The community determines which features get prioritized and implemented. Users can directly influence the development roadmap through a transparent ranking system of GitHub issues. Top-ranking issues guide the core team's work, ensuring the tool evolves based on user feedback and needs.  OpenTofu maintains a public GitHub repository where anyone can see what contributors are working on. The project uses an RFC process with pull request reviews to discuss new features and document engineering decisions. This transparency contrasts with Terraform's closed development model.

Real-World Adoption and Momentum: OpenTofu has gained significant traction since its January 2024 stable release. Registry traffic increased substantially between major releases, with GitHub stars currently more than 27K, with downloads reported at millions. Major organizations like Allianz and Fidelity have actually migrated to OpenTofu. 

Key Differences and Similarities Between Terraform and OpenTofu

Understanding how OpenTofu compares to Terraform helps teams make informed migration decisions.

Similarities

Both tools share nearly identical syntax, allowing you to use the same configuration files with minimal changes. The HashiCorp Configuration Language (HCL) remains the foundation for both. You write declarative infrastructure definitions that specify the desired end state, and the tool handles provisioning.​

State management works the same way. Both maintain a state file that tracks the current infrastructure, use state locking to prevent concurrent modifications, and support similar backend types for remote state storage. Your S3 buckets, or other backends, work with either tool.​

Provider ecosystems also overlap substantially. OpenTofu maintains compatibility with many Terraform providers. Providers for AWS, Google Cloud, Azure, Kubernetes, and other services work with both tools. Both tools also integrate into CI/CD pipelines using the same patterns. 

Differences

Licensing Model: Terraform operates under the Business Source License after version 1.5.x, restricting how vendors can use the tool commercially. OpenTofu uses the Mozilla Public License v2.0, ensuring it remains fully open source without usage restrictions. Each source file in OpenTofu guarantees permanent open-source status.​

Governance and Philosophy: HashiCorp controls Terraform's development and roadmap. OpenTofu employs community-driven governance through the Linux Foundation. The OpenTofu community ranks feature requests, and the core team prioritizes work based on these rankings. 

Specific Features: OpenTofu 1.7 added native state and plan file encryption. OpenTofu encrypts state data before it leaves your machine or CI runner, adding a critical security layer.​ OpenTofu 1.8 introduced the ability to use variables and locals in backend configuration, module sources, and encryption settings. This eliminates code duplication and allows dynamic backend selection based on environment variables. OpenTofu 1.9 added `for_each` support for provider blocks. This allows declaring a single provider configuration that instantiates multiple times across regions or accounts.

Version Alignment: OpenTofu initially forked from Terraform 1.5.x and maintains similar version numbering, but version alignment doesn't guarantee feature parity in genenal. For example, features introduced in Terraform 1.11.x will often appear in OpenTofu 1.11.x, but the implementation details, syntax, or behavior may differ. For example, while both tools might support a similar capability in the same version series, OpenTofu may implement it differently due to community priorities or technical decisions. Some Terraform features may not be ported at all if they conflict with OpenTofu's licensing or governance principles.

Future Trajectory: The two tools will continue diverging as OpenTofu implements community-requested features. OpenTofu will not keep pace with upstream Terraform releases and vice versa.

Considerations for Migration

When Terraform Makes Sense

Terraform remains a solid choice if you are invested in the HashiCorp ecosystem. Teams already using HashiCorp Vault, Consul, Nomad, or other HashiCorp products may benefit from staying within a single vendor's stack. The integration between these tools works smoothly, with features like Vault-backed dynamic credentials in Terraform Enterprise.​

When OpenTofu Makes Sense

OpenTofu excels when you prioritize vendor neutrality, open-source licensing, and community-driven development. The MPL 2.0 license provides certainty that the tool will remain open source forever. No vendor can impose future restrictions, price changes, or usage limitations.​

Long-Term Divergence

The two tools will inevitably drift apart. OpenTofu's changelog documents the growing feature gap. Eventually, maintaining compatibility with both may become impractical.​

Provider and Module Ecosystem Compatibility

Most Terraform providers and modules work with OpenTofu. OpenTofu's registry at search.opentofu.org mirrors most content from the Terraform registry. If you find a provider or module missing, you can request inclusion through the OpenTofu registry GitHub repository. The community typically responds quickly to registry addition requests.​

Check your provider sources carefully. By default, OpenTofu uses registry.opentofu.org. Configurations that explicitly reference registry.terraform.io may need updates to avoid potential licensing complications. Most providers published to both registries work identically, but it is worth validating.​

Planning for Large-Scale Migrations

Organizations with hundreds or thousands of Terraform stacks need a proper and validated migration strategy. First, audit current usage and document which Terraform and provider versions you use across all projects. Create an inventory of managed resources, provider versions, and module dependencies. Understanding your current state prevents surprises during migration.​

Next, assess tooling, automation, and CI/CD pipeline adjustment implications. Your pipelines need updates to replace `terraform` commands with `tofu`. Check compatibility with third-party tools that you use with Terraform, such as linters, security scanners,and  policy engines.

It’s critical before you start to maintain the ability to return to Terraform if issues arise. Back up your state files and code before migration. Test the rollback process on a non-critical stack to ensure you can execute it smoothly if needed.​

Organizations successfully migrating to OpenTofu emphasize careful planning and incremental rollouts. Fidelity's migration story demonstrates the process. They started with a proof-of-concept project called Lighthouse, socialized the idea among teams, and validated that the migration worked correctly. This built confidence before expanding to 70% of projects over two quarters. Robust reporting provided transparency about progress and issues.

Migration Process

The actual migration process varies depending on your starting Terraform version. OpenTofu provides specific migration guides for different Terraform versions.​

Determine Your Starting Point

Check your Terraform version first. OpenTofu offers different migration paths for Terraform 1.5.x or lower, 1.6.x, 1.7.x, 1.8.x, and 1.9.x. Each version requires slightly different steps and code changes.​

Migration Steps for Terraform 1.9.x

Let's walk through migrating from Terraform 1.9.x to OpenTofu, following the official migration guide.​

Step 0: Prepare a Disaster Recovery Plan

Create and test a disaster recovery plan before touching production infrastructure. This plan should include state file backup procedures, restore procedures, and rollback steps. Test the disaster recovery process at least once to ensure it works when needed.​ Make sure you version your code as well. Migration may require code changes, and having the original simplifies rollback if needed.​

Step 1: Apply All Pending Changes

Run `terraform apply` to ensure no pending changes exist. Execute `terraform plan` and verify it shows zero planned changes. Starting from a clean state simplifies troubleshooting if issues arise.​

Step 2: Document Current State (Optional)

If you wish, you can take a look and document the resources in scope from your state file with the `terraform state list` command. Document your current provider versions for reference.

Step 3: Install OpenTofu

Download and install OpenTofu following the installation instructions at opentofu.org. Verify the installation by running `tofu version` in your terminal.​

Step 4: Code Changes for Terraform 1.9.x

For successful migration from Terraform 1.9.x, you need specific code changes documented here.​ Notice that this step might be different depending on which version you are migrating from. In this case, you have to make changes to specific functions such as `encode_tfvars`, `decode_tfvars`, and `encode_expr`, make certain updates to S3 backends, `removed` blocks, testing changes, and input variable validation.

Step 5: Initialize OpenTofu

Run `tofu init` in your project directory. OpenTofu downloads providers and modules from the OpenTofu registry. The initialization updates the state file to reference the OpenTofu registry instead of the Terraform registry.​ If this step fails, do not proceed. Follow the rollback instructions to return to Terraform and troubleshoot the issue. If you suspect a bug in OpenTofu, open an issue on GitHub to help the project.​

Step 6: Inspect the Plan

Run `tofu plan` and verify there are no unexpected changes. The plan should show zero modifications, just like your final Terraform plan. Any unexpected changes indicate an issue requiring investigation before proceeding.​ Check provider versions, module sources, and any code changes you made. The OpenTofu community on Slack and GitHub Discussions can help troubleshoot migration issues.​

Step 7: Apply with OpenTofu

Even though the plan shows no changes, run `tofu apply`. This updates the state file with OpenTofu's metadata, completing the migration.​

Step 8: Test a Small Change

Before using OpenTofu for major infrastructure changes, test with a small, non-critical modification. This validates that your entire workflow works correctly with OpenTofu.​

Step 9: Upgrade to Latest OpenTofu Version

After the migration is complete, follow the OpenTofu upgrade guide to move to the latest version. This gives you access to the newest features and improvements.​

Rolling Back to Terraform

If you encounter issues during migration, follow these steps to roll back:​

  1. Create another backup of your state file and code​
  2. Remove any code changes you made​
  3. Run `terraform init​`
  4. Run `terraform plan` and verify no unexpected changes appear​
  5. Run `terraform apply` and verify it executes with no changes​
  6. Test the rollback with a small, non-critical change​

If you encountered a bug in OpenTofu, you can report it on GitHub Issues to help improve the project.​

StackGuardian Support for OpenTofu

StackGuardian provides comprehensive support for OpenTofu workflows, simplifying infrastructure management at scale. The platform integrates OpenTofu with features like managed state backends, automated drift detection, and lifecycle customization.​​

StackGuardian Modern Self-Service Platform Architecture

Managed OpenTofu State: StackGuardian can automatically inject and manage OpenTofu state files. Enable "SG Managed OpenTofu Backend" in OpenTofu Configuration, and StackGuardian handles secure, tracked, remote state management. The platform stores state in tfstate.json format.​ Alternatively, you can also explicitly configure StackGuardian's HTTP backend in your OpenTofu code, facilitating secure remote storage and state locking.

OpenTofu Plan Approval: Enable this feature to add governance by requiring approval before changes are applied. You can specify which users can approve workflows and how many approvals are needed.

Automated Drift Check: StackGuardian runs drift checks regularly on deployed infrastructure. If drift is detected, you can rerun the workflow to reconcile differences or modify the configuration to import changes.

OpenTofu Customizations: Configure specific OpenTofu settings, including version selection, extra CLI options, workflow step timeouts, and importing existing state files.

Lifecycle Custom Steps: Inject custom logic at different workflow stages. Pre-init, pre-plan, post-plan, pre-apply, and post-apply steps enable integration with security scanning, validation, or notification tools. For example, integrate security scanners like Wiz to validate plans before deployment.

Resources and Events: Allocate CPU and memory for workflow execution, chain workflows to execute sequentially, configure webhooks for notifications, and set up alerts for workflow events.

Conclusion

The migration from Terraform to OpenTofu reflects a choice around open-source preference, enterprise support needs, and community-driven development. For most teams using Terraform internally, the technical side of the migration is straightforward. The tools coexist today, but their paths diverge. Make your choice with full understanding of the implications for your infrastructure, team, and long-term strategy.

StackGuardian's platform provides the foundational layer for scaling your IaC needs, either with Terraform or OpenTofu. Book a demo today!

Share article
Blog

Terraform Is Dead - Or Isn’t It?

Why Infrastructure as Code Still Matters in the Era of Operators and AI Agents

Blog

The Platform Engineer’s Dilemma: Build, Buy, or Hybrid Strategies

Platform engineering strategies fall into three categories, each with distinct trade-offs. Read which ones suit you.

Blog

StackGuardian vs. HCP Terraform: Next-Gen Platform Engineering Alternative

HCP Terraform Cloud Alternative: How StackGuardian Delivers Next-Gen Infrastructure Orchestration

Blog

Building Golden Paths: Standardizing Cloud Deployments

Golden paths provide an easy, quick, safe, and replicable way to accomplish everyday tasks that align with organizational standards. Here's why you should use them

Press Release

StackGuardian Raises $10M to Accelerate Global Growth and Expand its Leading AI-Driven Infrastructure Automation & Orchestration Platform

Blog

Achieving DORA Compliance with Infrastructure as Code (IaC) and StackGuardian

A Financial Sector Perspective

Blog

From Terraform to OpenTofu: A Migration Guide

Daniel Caduri
January 19, 2026
Industry
Use Cases
Company Size
SDK
~0 min read

In today’s fast-paced digital world, businesses rely on servers more than ever to store, process, and manage their data.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean non commodo urna. Donec eu lobortis risus, vitae scelerisque nibh. Pellentesque eleifend convallis facilisis. Phasellus sed semper lorem, ac varius nisi. Proin pretium malesuada eros ac convallis. Nam condimentum, ex in posuere accumsan, justo felis tincidunt enim, quis ornare tortor sapien eu lectus.

Quisque suscipit euismod accumsan. In at ultricies nisi, ut varius ipsum.Nam lacinia at odio et viverra. Aliquam elit ex, volutpat sed ante et, semper dignissim risus. Morbi mi purus, vehicula sed elementum sit amet, placerat quis risus. Suspendisse est mi, fermentum a nunc et, sodales dictum tellus. Ut mattis porttitor risus, eget molestie sem ornare id. Quisque lobortis molestie vehicula. Nulla id suscipit arcu.Praesent laoreet euismod mauris, sit amet varius eros ullamcorper sed. Fusce congue eros non venenatis semper. Fusce finibus tortor ipsum, sit amet lacinia nunc ultrices vel. Suspendisse gravida aliquet felis sed accumsan. Morbi scelerisque turpis sed tellus blandit viverra.

Pellentesque nisi magna, volutpat vel tempor eu, consequat sit amet diam. Quisque sed lectus ut leo consectetur blandit. Donec efficitur risus sed orci mattis porttitor. In sodales justo et varius sodales. Suspendisse luctus, est vitae fermentum faucibus, tortor metus maximus massa, non posuere dui elit sit amet nunc. Praesent id vulputate sapien, ut lacinia lectus. Morbi diam dui, consequat non urna sed, cursus consequat nibh.Integer eget vehicula metus. Maecenas eu eleifend felis. Nulla auctor neque vitae orci congue cursus. Aenean at suscipit augue, nec faucibus nibh. Quisque convallis lacus at lacus tristique scelerisque in eu diam. Pellentesque egestas varius felis ut fermentum.

Praesent luctus, felis ut efficitur elementum, dolor leo vestibulum turpis, eu aliquam erat dui sed mi. Integer pellentesque, elit volutpat aliquam sagittis, erat mauris hendrerit augue, vitae gravida felis nisi eu nisi. Maecenas nisl urna, ultricies id arcu vitae, elementum auctor ante. Nam magna eros, interdum at scelerisque ut, viverra quis felis. Maecenas vitae ex quis mi venenatis tincidunt at et nisl. Nullam volutpat leo in semper bibendum. Aliquam pellentesque, diam in tempus pellentesque, ante nulla gravida diam, vel feugiat quam augue sollicitudin felis.Duis eu sagittis quam. Aliquam consectetur vehicula urna at tempus. Vivamus vel quam felis. Fusce eleifend non ipsum ac pharetra.

Duis suscipit feugiat venenatis. Cras ullamcorper quis velit a venenatis. Mauris ipsum lorem, dictum id posuere ac, consequat non tellus. Proin consectetur non ante id posuere. Donec viverra, leo in interdum eleifend, ligula augue facilisis magna, eu dictum urna risus mollis justo. Ut sit amet enim tortor. Integer sit amet lectus luctus orci vestibulum auctor lacinia quis erat. Donec nunc sapien, tempus nec porttitor a, luctus nec metus.

Share article
Blog

From Terraform to OpenTofu: A Migration Guide

OpenTofu emerged as the community's response fork of Terraform 1.5.x that maintains the MPL 2.0 license. It might be time to migrate - here's why

Blog

Terraform Is Dead - Or Isn’t It?

Why Infrastructure as Code Still Matters in the Era of Operators and AI Agents

Blog

The Platform Engineer’s Dilemma: Build, Buy, or Hybrid Strategies

Platform engineering strategies fall into three categories, each with distinct trade-offs. Read which ones suit you.

Blog

StackGuardian vs. HCP Terraform: Next-Gen Platform Engineering Alternative

HCP Terraform Cloud Alternative: How StackGuardian Delivers Next-Gen Infrastructure Orchestration

Blog

Building Golden Paths: Standardizing Cloud Deployments

Golden paths provide an easy, quick, safe, and replicable way to accomplish everyday tasks that align with organizational standards. Here's why you should use them

Press Release

StackGuardian Raises $10M to Accelerate Global Growth and Expand its Leading AI-Driven Infrastructure Automation & Orchestration Platform

Blog

Achieving DORA Compliance with Infrastructure as Code (IaC) and StackGuardian

A Financial Sector Perspective

Blog

StackGuardian vs. Backstage

Modern Platform Engineering: When to Build, When to Buy Your IDP — Beyond the Hype of Backstage.io

Blog

How AI can Impact Platform Engineering Implementations

Traditional approaches often fall short when organizations scale beyond simple deployments. Can artificial intelligence (AI) and agentic implementations bridge this gap?

Blog

Achieving GxP Compliance with Infrastructure as Code (IaC) and StackGuardian

In highly regulated industries, maintaining GxP (Good Practices) compliance is critical.

Blog

Terraform State Management at Scale: Strategies for Enterprise Environments

Terraform is one of the most popular tools for Infrastructure as Code (IaC). Let's understand Terraform State.

Blog

Implementing Cloud Security Best Practices with StackGuardian

Data breaches and misconfigurations can have serious consequences. Cloud security should be a top concern for every organization.

Blog

How Outcome-Driven Approaches Redefine DevOps and Platform Engineering Success

In the last decade, organizations chased the DevOps dream, drowning themselves in complexity and cognitive overload. Outcome-Driven Approaches Redefine DevOps and Platform Engineering Success

Blog

IaC: Best Practices & Implementation

Infrastructure as Code Best Practices & Implementation – transforming brittle, manual processes into repeatable blueprints for modern cloud operations.

Blog

Empower your Dev Teams: The Value of Self-Service Infrastructure

Imagine, a test environment closely matching production is automatically created for them. Developers don’t have to open a request and wait hours or days. This is the promise of self-service infrastructure!

Blog

Enhancing Developer Productivity with StackGuardian: A Game-Changer for Modern Teams

In today's fast-paced tech environment, developer productivity isn't just about writing code faster; it's about creating a workflow that allows developers to focus on innovation while maintaining efficiency, security, and compliance.

Blog

DevOps vs. Platform Engineering vs. Site Reliability Engineering (SRE)

Organisations today have a variety of approaches to managing software development and infrastructure operations. Three common models are DevOps, Platform Engineering, and Site Reliability Engineering (SRE). While there are some similarities, each has distinct goals, responsibilities, and practices.

Blog

StackGuardian and the DIE Framework: A Powerful Combination for Cybersecurity

The most common traditional security framework is the CIA triad, Confidentiality, Integrity, and Availability. The confidentiality, integrity, and availability of information is crucial to the operation of a business, and the CIA triad segments these three ideas into separate focal points. This differentiation is helpful because it helps guide security teams as they pinpoint the different ways in which they can address each concern.

Blog

What is YBIYRI?

You build it, you run it (YBIYRI) is growing in popularity. Here's everything you need to know