Switching from Terraform: Integrate with OpenTofu in Walrus
What is OpenTofu?
OpenTofu is an open-source Infrastructure as Code (IaC) framework presented as an alternative to Terraform and managed by the Linux Foundation. It was developed in response to HashiCorp's decision to change Terraform's licensing from the Mozilla Public License v2.0 (MPLv2) to a Business Source License v1.1. The aim of OpenTofu is to offer a dependable and impartial option for infrastructure as code management, ensuring it remains truly open-source under a stable license.
Under the guidance of the Linux Foundation, OpenTofu seamlessly replaces Terraform v1.6.x while ensuring complete backward compatibility with Terraform v1.5.x and its predecessors.
Since its inception, it has instantly sparked considerable interest. As of the time of this writing, the OpenTofu project has over 16K GitHub stars, while the OpenTofu Manifesto project has over 36K GitHub stars.
Integrating OpenTofu in Walrus
By default, Walrus uses Terraform as its deployment engine. Since OpenTofu is a drop-in replacement of Terraform, you can seamlessly set up OpenTofu in the Walrus system without any code changes.
Start by following the Quick Start guide to deploy the Walrus Server and set up a container service in a Kubernetes cluster.
First, let's check the deployment log for the service.
It's evident that the deployment was executed using Terraform.
Now, let's switch to OpenTofu by following these steps:
Click on System Settings in the left navigation menu.
Click on the Deployment Management tab.
Press the edit button next to Basic Settings.
Change the Deployer Image to sealio/opentofu-deployer:v1.6.0-beta5-1.
Click the Save button.
That's it! Walrus will now use OpenTofu as the deployment engine. Let's create another service by following these steps:
Click on Application Management in the left navigation menu.
Enter the dev environment detail page by clicking on it.
Press the New button and select Service.
Enter the name myapp-tofu.
Choose the containerservice template.
Fill in nginx in the Image field.
Click Save and Deploy.
After the deployment finishes, let's take a look at the deployment log again.
This instance showcases OpenTofu's presence in the log. Walrus executed the deployment using OpenTofu. However, in the CLI arguments, as depicted in the image, terraform is aliased to tofu.
At the time of writing this article, OpenTofu is gearing up for its first stable release set for the upcoming month. The switch from Terraform to OpenTofu for end-users is not about adopting a new name that sounds more fragile :-). Rather, we're poised to witness innovative solutions from OpenTofu addressing tangible challenges in our landscape.