Switching from Terraform: Integrate with OpenTofu in Walrus

Switching from Terraform: Integrate with OpenTofu in Walrus

·

2 min read

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 for 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.

deployment-log

It's evident that the deployment was executed using Terraform.

Now, let's switch to OpenTofu by following these steps:

  1. Click on System Settings in the left navigation menu.

  2. Click on the Deployment Management tab.

  3. Press the edit button next to Basic Settings.

  4. Change the Deployer Image to sealio/opentofu-deployer:v1.6.0-beta5-1.

  5. Click the Save button.

basic-settings

That's it! Walrus will now use OpenTofu as the deployment engine. Let's create another service by following these steps:

  1. Click on Application Management in the left navigation menu.

  2. Enter the dev environment detail page by clicking on it.

  3. Press the New button and select Service.

  4. Enter the name myapp-tofu.

  5. Choose the containerservice template.

  6. Fill in nginx in the Image field.

  7. Click Save and Deploy.

After the deployment finishes, let's take a look at the deployment log again.

deployment-details-opentofu

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 totofu.

What's Next?

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.

Welcome to the community!