OpenTofu
OpenTofu
April 19, 2024

Everything You Need to Know About OpenTofu

By
Sebastian Stadil

What is OpenTofu?

Now that OpenTofu has joined the Linux Foundation we wanted to answer all of your questions. As a reminder, HashiCorp updated their license for all of their products from a Mozilla public license to BUSL, which prevents any other product they view as a competitor from using Terraform version 1.6.0 and higher. As a result, OpenTofu is a Terraform fork from version 1.5.x to provide a drop-in replacement and truly open source alternative to Terraform. 

OpenTofu 1.7.0 Beta is Out!

The 1.6.0 release was the first GA release, but now we’re on to implementing new features in 1.7.0! The 1.7.0 beta version was released recently and you can test it out today. Here are a few of the highlights:

  • State encryption: Encrypt your state locally or in a remote backend, something the community has been waiting on in Terraform for years!
  • Removed block: Remove a resource from state without worrying about it being deleted form the provider.

On top of the main highlights above, there were many other improvements and fixes that were added by the community. See all of the release information here.

How can I install it?

You can install it by going to the “installing OpenTofu” page on the main OpenTofu site. Most users will likely start with Homebrew on their MacOS, but you’ll see there are packages for all operating systems.

Your other option is to test directly in Scalr. You’ll see you now have the option to select between Terraform and OpenTofu.

One important thing to note is that OpenTofu is now in testing for the Alpine Linux distributions and Terraform has been dropped by the team supporting AlpineLinux due to the license change. More can be seen here.

Current Status of OpenTofu

The community around Opentofu continues to grow now that the GA release is out and is adding some long-awaited features in 1.7.0 For those interested in the release cadence, the current model is to release when the flagship feature for that release is ready. So, as soon state encryption is ready to go GA, the GA version of 1.7.0 will be released.

Keep up to date on the updates to OpenTofu in their weekly updates. Also, check out one of the various OpenTofu conferences worldwide through the help of the Linux Foundation.

History of OpenTofu

When the license change was announced, Scalr as well as others, like Gruntworks, Harness, Spacelift, and Env0 knew that they would be impacted. The license language was very vague and there was no way of knowing if our offerings would violate their license.

With that, a team of individuals made the decision to create the OpenTofu manifesto. The manifesto was created to make individuals aware of what was at stake as well as push HashiCorp to contribute Terraform to a foundation such as the Linux Foundation or CNCF, where most open source projects live. The manifest gained support of hundreds of companies and individuals in just a short time, which proved there was serious support from the rest of the open source community.

As predicted, Hashi did not donate the project, which then resulted in the forking of Terraform 1.5.x, the last version under the Mozilla public license, and the launch of OpenTofu. Originally, the project was named OpenTF,  but at the advice of legal teams, it was changed to something that was not related to Terraform at all.

On September 20th, 2023 at the open source summit in Europe, the Linux Foundation Executive Director, Jim Zemlin, and Scalr CEO, Sebastian Stadil, announced the acceptance of OpenTofu into the Linux Foundation under the name OpenTofu. Representatives from ExpressVPN and Allianz joined them on stage to show support for the OpenTofu project. 

To date, companies like Scalr, Env0, and Spacelift have either hired or have openings to hire full-time developers to join the OpenTofu team and support the OpenTofu initiative.

Joining the Linux Foundation

Foundations such as the Linux Foundation or the CNCF were created to ensure open source projects remain impartial, are maintained by a community, and have a collective commitment to excellence.. By joining a foundation, you will not have to worry about a license change that impacts all organizations and users that use the software. Foundations are great at maintaining standards, driving open collaboration, and ensuring projects have a long lived success without external companies influencing the direction.

How can I contribute?

Terraform went from a project that was truly community driven to one that was basically maintained by a few members of the HashiCorp team before the license change happened. This is not going to happen with OpenTofu. We encourage everyone in the community to contribute and make their voice heard by opening pull requests, reporting bugs, testing bug fixes, and participating in discussions in the public repo.

You can also join the growing Slack community where members of the core OpenTofu team work together with the general community. That link to join is here.

Lastly, the project is governed by a Technical Steering Committee that publishes minutes from each meeting here.

What are the OpenTofu commands?

At this time, there is no difference between the Terraform and OpenTofu commands other than calling “tofu” rather than “terraform”. The basic commands remain the same:

tofu
Usage: tofu [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
  init          Prepare your working directory for other commands
  validate      Check whether the configuration is valid
  plan          Show changes required by the current configuration
  apply         Create or update infrastructure
  destroy       Destroy previously-created infrastructure

All other commands:
  console       Try OpenTofu expressions at an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote OpenTofu modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a OpenTofu resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  metadata      Metadata related commands
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  test          Execute integration tests for OpenTofu modules
  untaint       Remove the 'tainted' state from a resource instance
  version       Show the current OpenTofu version
  workspace     Workspace management

Global options (use these before the subcommand, if any):
  -chdir=DIR    Switch to a different working directory before executing the
                given subcommand.
  -help         Show this help output, or the help for a specified subcommand.
  -version      An alias for the "version" subcommand.
  • tofu init: before you can start working with OTF in a project directory, you need to initialize it using tofu init. This command downloads the necessary providers and modules defined in your configuration files, ensuring that your environment is properly set up.
  • tofu plan: use tofu plan to generate an execution plan. OTF will analyze your configuration files, compare them to your existing infrastructure (if any), and display a summary of what changes will be made when you apply the configuration. This step helps you understand the impact of your changes before actually making them.
  • tofu apply: once you're satisfied with the execution plan, you can apply your changes using tofu apply. This command creates or updates the resources specified in your configuration files. OTF will prompt you to confirm the changes before proceeding.

How Can I Migrate to OpenTofu

The migration to OpenTofu is straightforward as you do not need to make changes to any of your files, but we do encourage you to backup your state file and do some testing first. Migrating to OpenTofu is the same as upgrading to a major version of Terraform. Please see the official guide on the migration here.

What is the difference between OpenTofu and Terraform?

At this point, there are very few differences between OpenTofu and Terraform. OpenTofu was forked from Terraform version 1.5.x so you can expect the same functionality that you have always used in Terraform. The differences really come down to the command you’re going to use in the CLI to interact with OpenTofu and then the names you see in the output.

What versions of Terraform are on the old license?

The shift from Terraform to OpenTofu is undoubtedly going to take some time. It is expected that both Terraform and OpenTofu will be used in parallel for some time. At this point in time, you can continue to use Terraform 1.5.x and lower without having to worry about the license change. Once you are ready for a newer version, you can opt to stick with Terraform or use OpenTofu.

Does OpenTofu need to fork the Hashicorp providers? What happens if Hashicorp stops maintaining a provider? What happens if they make the providers incompatible with OpenTofu?

OpenTofu is compatible with all Terraform providers.

In the very rare event you find a provider that works for Terraform but doesn’t for OpenTofu, please let us know so we can immediately fix it. In the future, we might even have a bounty for such cases!

Most providers are maintained by a community, a majority of which is often employed by an interested vendor. For example, the Datadog provider is mostly maintained by Datadog engineers. If any software developer, whether HashiCorp or other, stops maintaining a particular provider, then it’ll likely gradually have issues such as incomplete functionality coverage or incompatibility with newer OpenTofu and Terraform versions. If the provider is popular, some helpful members of the OpenTofu and Terraform communities may decide to help out and maintain it.

There have been some discussions about making a standard provider format, but nothing to share publicly yet.

Can OpenTofu compatibility with Terraform be guaranteed long term? Do separate providers need to be created for OpenTofu Terraform, ie. will there be duplicate or extra work? What longevity will OpenTofu have?

We’re committed to ensuring that OpenTofu supports all Terraform providers, short, mid and long term.

In addition, there is no “separate provider” for OpenTofu and for Terraform: 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 will you need to add additional tests. In the rare event that your provider works for Terraform but not for OpenTofu, please let us know so we can immediately investigate and restore compatibility.

In terms of longevity, the Linux Foundation provides a great framework for long term project success, like the Technical Steering Committee or a requirement that projects have maintainers from many organizations to provide redundancy. There are already several dozen contributors, some one-time, some full-time, so the project is moving fast.

Are there any big organizations backing OpenTofu?

We can't make any announcements just yet, but thinking from first principles: none of the big cloud providers (or any vendor for that matter) love the developer experience being out of their control, and even less having it in the hands of an organization seeking to monetize their middleman position. OpenTofu, with its transparent and open-to-all development model, is in a unique position to provide the big cloud providers with the ability to improve the experience where they want to improve it. It follows suit that one should expect them to contribute to the project.

Oracle has already publicly started, for example, with a proposal to add OCI as a state storage backend.

Where does the OpenTofu name come from?

We get this question a lot! Picking a name for any project is hard, and picking a good name is even harder. We wanted something that was easy to remember and use, without causing confusion in the market. It had to be short since we’ll be typing it a lot (tofu), and unique as to be easy to google. OpenTofu is all those things.

And as a bonus, the little yellow tofu cube makes for a super cute mascot (have you started collecting all the tofu stickers?).

What's the partnership between OpenTofu and Hashicorp? Will it be contentious?

We of course can’t speak for Hashicorp, but as far as the OpenTofu community goes, we are eternally grateful for the contributions made by Mitchell and Hashicorp. We don’t see the relationship as contentious, more so a simple difference in values.

We would be thrilled to welcome Hashicorp into the OpenTofu community. This would be the best possible outcome from the fork: the Terraform and OpenTofu communities merging under the neutral Linux Foundation umbrella. The door will always be open.

It might be important to note that Scalr, from which you are reading this FAQ, got started because it simultaneously 1) believed in the potential of building great developer experiences on top of Terraform, and 2) observed that Hashicorp wasn't executing well on Terraform Cloud / Enterprise which left a gap that the market filled. Many other commercial and non-commercial organizations came to this realization and similarly built value-add products for the Terraform language, and it is sad that Hashicorp feels the need to pull the rug on the community in an effort to catch up.

What's Next?

The first stable release of OpenTofu is the main goal right now. A tremendous amount of work has been done to put in a best in class development process, but we will continue to improve. The project is in the process of being transitioned to the Linux Foundation where they already have existing processes and standards that will only accelerate the progress. The Cloud Native Computing Foundation, an organization that is part of the Linux Foundation, is also the next step in terms of foundations. The CNCF is mainly focused on projects specific to infrastructure, which is exactly what OpenTofu is.

We encourage you to follow the OpenTofu project, check out the code changes, and open pull requests as the OpenTofu project gets closer to the first stable release for a drop-in replacement for Terraform!

We’ll continue to update this post when there is new information to share! Sign Up to try OpenTofu on Scalr today!

Originally published on November 30th 2023.

Note: While this blog references Terraform, everything mentioned in here also applies to OpenTofu. New to OpenTofu? It is a fork of Terraform 1.5.7 as a result of the license change from MPL to BUSL by HashiCorp. OpenTofu is an open-source alternative to Terraform that is governed by the Linux Foundation. All features available in Terraform 1.5.7 or earlier are also available in OpenTofu. Find out the history of OpenTofu here.

Start using the OpenTofu & Terraform platform of the future.

A screenshot of the modules page in the Scalr Platform