July 10, 2024

Why You Should Use OpenTofu Instead of Terraform

Table of Contents

This blog post highlights the reasons for choosing OpenTofu over Terraform, emphasizing its open-source nature, community-driven development, compatibility with existing Terraform setups, and assured freedom to innovate.

Introduction

Over the last 9-10 years, Terraform has become synonymous with “Infrastructure as Code,” being the go-to tool within the domain. Over this time, a vast ecosystem has built up around the open source tool, both in terms of community and tooling, with a wide range of providers, modules, tooling, and services, extending its applicability, reach, and adoption.

OpenTofu Catalyst

However, like the rest of the technology space, the IaC landscape is constantly evolving. Part of this evolution happened when Terraform’s licensing model was changed from the open-source Mozilla Public License (MPL) to a more restrictive Business Source License (BSL). This change limited Terraform’s commercial use and made it costly or illegal for previous ecosystem solutions that competed with the parent company to carry on.

This move was followed by introducing a new pricing model for their management tool. This new pricing approach significantly increased costs making Terraform management cost-prohibitive for many of its users, especially for those managing large-scale infrastructures. As a result, many users faced unexpected financial burdens.

These moves caused Terraform users to reevaluate their reliance on the IaC tool and its parent company. They revealed risks associated with being tied to the success and whims of a single company for what had become a foundational tool for operating cloud application infrastructures at scale.

What is OpenTofu?

Terraform users began to seek alternatives, which led to the creation of the OpenTofu Manifesto. OpenTofu was forked from Terraform to ensure the IaC tool remains open source. Managed by the Linux Foundation and with a CNCF application underway, OpenTofu operates under a well-known, widely accepted open-source license, providing long-term assurance against sudden, unilateral license changes.

Key Benefits of OpenTofu

Truly open source

OpenTofu is committed to staying under a well-known and widely accepted open-source license, ensuring transparency and allowing companies to adopt OpenTofu without fear of future legal entanglements.

Community-driven development

OpenTofu's governance is rooted in community involvement. Pull requests are evaluated and accepted based on their merit and value to the community, fostering a collaborative and innovative environment where developers can confidently contribute and use the tool.

Impartial management

Managed by the Linux Foundation, OpenTofu operates under a neutral entity, ensuring no single company can dictate its direction. This impartiality means that valuable features and fixes are included based on their benefits to the broader community, not the interests of any one vendor.

Layered & modular architecture

OpenTofu’s architecture is designed to be programmer-friendly, encouraging the development of additional tools and integrations. This modular approach enables a vibrant ecosystem to grow around the core project, similar to the ecosystems seen around other successful open-source projects, such as Kubernetes.

Backwards-compatible

OpenTofu maintains compatibility with the forked version of Terraform, ensuring that current investments in infrastructure as code continue to provide value. Users can transition to OpenTofu without losing the functionality or stability of their existing setups.

Features and Compatibility

OpenTofu maintains compatibility with existing Terraform configurations, making it easy to switch. Already, major eco-system tool providers such as Oracle, Vmware, and Grafana Labs have switched to OpenTofu, telling their customers that they will no longer support Terraform. However, OpenTofu never planned to be just a shadow project of Terraform, so after the initial 1.6 stable release, thoughts turned to how the project could innovate to become the leading IaC tool.

This has led to OpenTofu 1.7 and 1.8 (the latest as of this writing) introducing new functionalities such as client-side state encryption, loop-able import blocks, and dynamic provider-defined functions in 1.7, and in 1.8, mechanisms to allow OpenTofu-specific overrides, balancing the commitment to compatibility while enabling future innovations.

Migration

As a fork of Terraform, OpenTofu has backward compatibility and migrating to OpenTofu is straightforward. Provided you aren’t using new functionality from Terraform 1.7 onward:

  1. Backup your terraform code and state file
  2. Ensure there are no more changes to be made (terraform plan and terraform apply)
  3. Set up the OpenTofu environment (tofu init)
  4. Check there are are no changes to be made (tofu plan)
  5. If no changes it is safe to update the state file to Open Tofu (tofu apply) 

Full migration guides for each version can be found at https://opentofu.org/docs/intro/migration.

Conclusion

OpenTofu offers a truly open-source, community-driven, and impartial IaC tool, making it a reliable choice for managing your infrastructure. Its commitment to open-source values, modular architecture, and backward compatibility ensures it is a robust and future-proof solution.

Its open-source license ensures that users will continue to have an ecosystem of competitive products and enhancements to this foundational tool for operating cloud application infrastructures at scale. For example, IaC Management tools, such as IaCM from Harness (an OpenTofu founding member and sponsor), can provide secure state file hosting, versioning, and diffs, automatic rollbacks, drift detection, policy enforcement, change approvals, and powerful infrastructure pipeline automation and testing with full audit trails. All are necessary as you scale up your use of infrastructure as Code.

Thankfully, OpenTofu exists to keep IaC evolving in a positive direction.

Infrastructure as Code Management