Terraform isn't open source anymore... Is there any solution ?

Terraform isn't open source anymore... Is there any solution ?

In August 2023, HashiCorp, the primary contributor to Terraform, adopts the BSL license for all its future product versions. While it doesn't pose a problem for most users, this license prohibits the use of the software for commercial purposes. Indeed, HashiCorp's competitors were using the code for their business.

What to Do?

For the average user, there are no noticeable changes. As a company, you can continue to use Terraform, if you're not a HashiCorp competitor.

As a result, all solutions built around the use of Terraform (Terragrunt, Atlantis) can no longer use the HashiCorp's code.

An Alternative: OpenTofu

Alternatives are being put in place, starting with OpenTofu. Its main purpose is to preserve the open-source essence of Terraform. Proposing to revert it to a fully open license is an invitation to HashiCorp to reconsider and bring Terraform back to its open-source root principes.

A significant step was recently taken by OpenTF: its submission to the Linux Foundation, with the ultimate goal of integrating with the Cloud Native Computing Foundation. This technical approach aims to ensure that OpenTofu remains authentically open source and independent. This will also make it more community-oriented. For example, in 2016, HashiCorp refused to approve a PR to encrypt the tfstate because it was done in their paid offering (for your information, this feature will be integrated into OpenTofu 1.7)...

Here's the opentofu code : come take a look!

https://github.com/opentofu/opentofu/

What are the technical differences compared to Terraform?

OpenTofu is a fork of Terraform V1.5.5. Anything in place since (or before) this version is therefore compatible with OpenTofu.

Depending on the providers and components used in the .tf files, there will be little or no changes, except for the executable which will no longer be Terraform but OpenTofu.

How does the future look for both solutions?

With significant contributions from various community companies, it seems that the development of OpenTofu will likely overtake Terraform. Here are some features released or about to be released in OpenTofu:

1.6 - Dedicated OpenTofu Registry

1.6 - Testing Framework

1.6 - Enhanced S3 backend

1.7 - Encryption of tfstate

Practical aspect: How to go from Terraform to OpenTofu?

Here are the main steps to take to transition from Terraform to OpenTofu:

Step 1: Prepare a recovery plan

Indeed, transitioning from Terraform to OpenTofu can be risky, and it's important to have the ability to revert to a previous state.

Step 2: Apply pending changes with TerraForm

Before migrating, ensure that there are no pending changes in Terraform. Therefore, a plan/apply should be done.

Terraform plan

Terraform apply

Step 3: Install OpenTofu

Example using snap:

snap install --classic opentofu

Step 4: Backup the tfstate

It's important to backup the tfstate file before making any changes.

Step 5: tofu init

This step initializes the backends and the tofu tool. It will download the providers and various modules referenced in the configuration.

tofu init

Step 6: tofu plan and apply

OpenTofu should not indicate any changes if step 2 has been done correctly.

tofu plan

tofu apply