🎓 A1Learner
🔍
0 of 50 lessons completed

Terraform, OpenTofu and the Licence Split

OpenTofu is an open-source fork of Terraform. It was created after Terraform changed its licence, and it keeps the same language.

Two licences, one language

The licence decides how the code may be used. It does not change how a lesson is written.

# Terraform 1.6+
# Licence: Business Source License 1.1

# OpenTofu
# Licence: Mozilla Public License 2.0

Version pins still work

Both tools read the same version rules. A pin written for one works in the other.

terraform {
  required_version = ">= 1.0"
}

Check which tool you have

The version command names the tool and its version. It is the quickest check.

terraform version

Example

# main.tf
terraform {
  required_providers {
    local = {
      source  = "hashicorp/local"
      version = "2.9.1"
    }
  }
}

resource "local_file" "hello" {
  filename = "hello.txt"
  content  = "Hello from Terraform."
}

# Commands:
# terraform init
# terraform apply

Key points

  • Terraform 1.6 and later is released under the Business Source License 1.1.
  • OpenTofu is a fork of Terraform, released under the Mozilla Public License 2.0.
  • A fork is a copy of the code that is then developed on its own.
  • The two tools share the same language, so a learner can move between them.
  • Most commands, blocks and providers work in the same way in both.

The language is the same in both tools. A file written for Terraform runs in the same way in OpenTofu. The licence is the difference, not the code.

Note

This course uses Terraform 1.17.1. The lessons still teach the shared language.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is OpenTofu?