Join our community of software engineering leaders and aspirational developers. Always
stay in-the-know by getting the most important news and exclusive content delivered
fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter
in the past. Click the button below to open the re-subscribe form
in a new tab. When you're done, simply close that tab and continue
with this form to complete your subscription.
The New Stack does not sell your information or share it with
unaffiliated third parties. By continuing, you agree to our
Terms of Use and
Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!
We’re so glad you’re here. You can expect all the best TNS content to arrive
Monday through Friday to keep you on top of the news and at the top of your game.
What’s next?
Check your inbox for a confirmation email where you can adjust your preferences
and even join additional groups.
Follow TNS on your favorite social media networks.
In the ever-evolving landscape of Infrastructure as Code, the Linux Foundation’s recent unveiling of the OpenTofu project marks a watershed moment. Launched on Sept. 20, at Open Source Summit Europe, in Bilbao, Spain, OpenTofu has emerged as a compelling alternative to Hashicorp’s Terraform, especially in light of the company’s recent shift from a Mozilla Public License to a Business Source License.
Backed by companies like Harness, Gruntwork and Spacelift, with a starting commitment of at least 18 full-time developers for the next five years, OpenTofu is not just another project but a collective commitment to open collaboration and innovation. One of its most promising features is its commitment to backward compatibility, making it an attractive option for those considering to migrate from other Infrastructure as Code tools.
In this quick guide, we’ll walk you through the steps to get started with the OpenTofu alpha release.
The Linux Foundation is the world’s leading home for collaboration on open source software, hardware, standards, and data. Linux Foundation projects are critical to the world’s infrastructure including Linux, Kubernetes, Node.js, ONAP, Hyperledger Foundation, PyTorch, RISC-V, and more.
Learn More
The latest from Linux Foundation Training
How Do I Download OpenTofu?
Go to the release page of the OpenTofu repo and select the binary corresponding to the operating system on which you will be using OpenTofu.
What Is Included?
First, a complete renaming of Terraform to OpenTofu had to be done for legal reasons. The team also had to ensure a suitable OpenTofu registry was in place, as the existing Terraform registry is only allowed to be used with Terraform.
From an end-user perspective, it is just a difference in the command line. Instead of calling `terraform`, you will now call `tofu`. All of the existing Terraform commands that were present from 1.5.x and below will continue to work.
What Do I Need to Know about the Provider Registry?
The original Terraform registry is essentially a metadata server that shows all the information regarding the providers, with the providers actually living in third-party sources like GitHub. The team created its own registry, ensuring that all existing 2,260 providers will continue to work without violating Hashicorp terms of service.
The release of the registry is considered alpha, with work underway to make a production-ready registry. If you’re interested in contributing to the registry, you can find the repo here.
OpenTofu Commands
Once downloaded, there is little difference between the Terraform 1.5.x and OpenTofu commands. 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` — Initializes the working directory where the configuration files are located. All modules, providers and plug-ins are downloaded or upgraded during this time.
`tofu plan` — Executes a “dry run,” meaning that the resources are not actually created; instead you can see a preview of what to expect if the apply were to happen.
`tofu apply` — Executes a run in which the resources defined in your configuration files are actually created.
How Do I Migrate from Terraform to OpenTofu?
It’s simple; you only need to run OpenTofu commands on your existing state files. As seen here, I have an existing state file that was created using Terraform 1.5.0 and the null resource provider:
I added the OpenTofu binary, and then ran a `tofu init`:
tofu init
Initializing the backend...
Initializing provider plugins...
- Reusing previous version of hashicorp/null from the dependency lock file
- Using previously-installed hashicorp/null v3.2.1
OpenTofu has been successfully initialized!
You may now begin working with OpenTofu. Try running "tofu plan" to see
any changes that are required for your infrastructure. All OpenTofu commands
should now work.
If you ever set or change modules or backend configuration for OpenTofu,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Ran a `tofu plan`:
tofu plan
null_resource.example: Refreshing state... [id=3925604235592252374]
No changes. Your infrastructure matches the configuration.
OpenTofu has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
For good measure, I ran a `tofu apply`, and we can see that the only thing that changed was the version, which now shows 1.6.0, which is the current version of OpenTofu I am testing on.
Everything worked as expected, and there was no need to do any major migrations; just update the binary.
Use It in Scalr Today!
To switch to OpenTofu in Scalr, you simply need to update your workspace settings. Go to your pipeline settings and search for version 1.6.0 and save. The next run will update your workspace to use OpenTofu!
How Do I Report Issues or Contribute?
With any alpha release, it is expected that improvements will be needed and bugs will be identified. If you are interested in contributing or find an issue, please feel free to open an issue in the public repo here.
The Linux Foundation is the world’s leading home for collaboration on open source software, hardware, standards, and data. Linux Foundation projects are critical to the world’s infrastructure including Linux, Kubernetes, Node.js, ONAP, Hyperledger Foundation, PyTorch, RISC-V, and more.