Skip to main content
๐ŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy โ€” plus the companion book on Leanpub & Amazon. Start Learning
Terraform vs OpenTofu: Migration Guide and Feature Comparison (2026)
DevOps

Terraform vs OpenTofu: Migration Guide and Feature Comparison (2026)

Complete guide to choosing between Terraform and OpenTofu โ€” licensing, feature parity, migration steps, and when to switch.

LB
Luca Berton
ยท 1 min read

The BSL Fork

In August 2023, HashiCorp switched Terraform from MPL 2.0 to BSL (Business Source License). The community responded by forking it as OpenTofu under the Linux Foundation.

Timeline

  • 2023-08: HashiCorp announces BSL license
  • 2023-09: OpenTofu manifesto (10,000+ signatures)
  • 2023-12: OpenTofu 1.6 GA (first stable release)
  • 2024-06: OpenTofu 1.7 (state encryption, removed blocks)
  • 2025-01: OpenTofu 1.8 (provider-defined functions)
  • 2026-01: OpenTofu 1.9 (module testing, stack orchestration)

Feature Comparison (2026)

FeatureTerraformOpenTofu
LicenseBSL 1.1MPL 2.0 (truly open)
State encryptionโŒ (requires Terraform Cloud)โœ… Native
Provider-defined functionsโœ…โœ…
Removed blocksโŒโœ… (clean refactoring)
Registryregistry.terraform.ioregistry.opentofu.org
Provider compatibilityโœ…โœ… (99% compatible)
Module compatibilityโœ…โœ…
Cloud/EnterpriseTerraform Cloud ($$$)Spacelift, env0, Scalr
IBM ownershipโœ… (acquired 2024)โŒ (Linux Foundation)

Migration Steps

1. Check Compatibility

# Most configurations work without changes
# Check for HashiCorp-specific features
grep -r "terraform {" . | grep -v ".terraform"
grep -r "cloud {" .  # Terraform Cloud blocks need removal

2. Install OpenTofu

# macOS
brew install opentofu

# Linux
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sh

# Verify
tofu --version

3. Initialize

# Replace 'terraform' with 'tofu' in all commands
tofu init
tofu plan
tofu apply

4. State Migration

# State files are compatible โ€” no migration needed!
# Just point OpenTofu at your existing state
tofu init -backend-config="bucket=my-state-bucket"

5. CI/CD Updates

# GitHub Actions
- uses: opentofu/setup-opentofu@v1
  with:
    tofu_version: "1.9.0"

- run: tofu init
- run: tofu plan -out=plan.tfplan
- run: tofu apply plan.tfplan

State Encryption (OpenTofu Exclusive)

terraform {
  encryption {
    key_provider "pbkdf2" "main" {
      passphrase = var.state_passphrase
    }

    method "aes_gcm" "main" {
      keys = key_provider.pbkdf2.main
    }

    state {
      method = method.aes_gcm.main
    }

    plan {
      method = method.aes_gcm.main
    }
  }
}

State files are encrypted at rest โ€” no more secrets in plaintext state.

When to Stay with Terraform

  • โœ… Heavy Terraform Cloud/Enterprise investment
  • โœ… Team training is all Terraform-branded
  • โœ… Using HCP-exclusive features (Sentinel, cost estimation)
  • โœ… IBM support contract required

When to Switch to OpenTofu

  • โœ… Want truly open-source (no license risk)
  • โœ… Need state encryption natively
  • โœ… Avoid IBM/HashiCorp vendor lock-in
  • โœ… Open-source company (BSL may affect your distribution)
  • โœ… Using third-party CI/CD (Spacelift, env0, Atlantis)

Free 30-min AI & Cloud consultation

Book Now