Esta página se muestra en inglés. Una traducción al español está en curso.
SkillsApr 15, 2026·3 min de lectura

OpenTofu — Community-Driven Open-Source Terraform Alternative

The Linux Foundation fork of Terraform — MPL-2.0 licensed, drop-in compatible, with state encryption and provider-iteration built in.

Listo para agents

Instalación con revisión previa

Este activo requiere revisión. El prompt copiado pide dry-run, muestra escrituras y continúa solo tras confirmación.

Needs Confirmation · 64/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
OpenTofu Playbook
Comando con revisión previa
npx -y tokrepo@latest install 7401055f-38ef-11f1-9bc6-00163e2b0d79 --target codex

Primero dry-run, confirma las escrituras y luego ejecuta este comando.

TL;DR
OpenTofu is a Linux Foundation Terraform fork with MPL-2.0 license and state encryption.
§01

What it is

OpenTofu is the Linux Foundation fork of Terraform, created after HashiCorp changed Terraform's license from MPL-2.0 to BSL. OpenTofu maintains the MPL-2.0 open-source license and is a drop-in replacement for Terraform. It adds features like state encryption and provider-defined functions that Terraform does not offer.

This tool targets infrastructure engineers and platform teams who rely on Terraform but want to stay on a truly open-source tool with community governance.

§02

How it saves time or tokens

OpenTofu is compatible with existing Terraform configurations, providers, and modules. Migration requires minimal effort: replace the terraform binary with tofu. State files are compatible. The added state encryption feature saves teams from building custom encryption wrappers. For AI-assisted infrastructure management, the same HCL knowledge applies.

§03

How to use

  1. Install OpenTofu via your package manager or download the binary.
  2. Replace terraform commands with tofu commands.
  3. Initialize your existing Terraform project with tofu init.
  4. Plan and apply as usual.
# Install on macOS
brew install opentofu

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

# Initialize a project (works with existing Terraform configs)
tofu init

# Plan changes
tofu plan

# Apply changes
tofu apply

# Enable state encryption
tofu init -backend-config='encrypt=true'
§04

Example

An OpenTofu configuration with state encryption:

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
      enforced = true
    }
  }

  backend "s3" {
    bucket = "my-state-bucket"
    key    = "prod/terraform.tfstate"
    region = "us-east-1"
  }
}

resource "aws_instance" "web" {
  ami           = "ami-0c55b159cbfafe1f0"
  instance_type = "t3.micro"
}
§05

Related on TokRepo

§06

Common pitfalls

  • Some Terraform providers may lag in OpenTofu compatibility. Check the OpenTofu registry for provider availability before migrating.
  • State encryption adds a key management responsibility. Losing the encryption passphrase means losing access to your state file.
  • CI/CD pipelines need to be updated to use the tofu binary instead of terraform. Environment variables and paths may need adjustment.
  • OpenTofu and Terraform may diverge in features over time. Keep an eye on compatibility if you use both in different projects.
  • Third-party tools that integrate with Terraform (like Terragrunt, Atlantis) may need updates for OpenTofu compatibility.
  • Review the official documentation before deploying to production to ensure compatibility with your specific environment and requirements.

Preguntas frecuentes

Is OpenTofu a drop-in replacement for Terraform?+

Yes for most use cases. OpenTofu reads existing Terraform configuration files, state files, and providers. Replace the terraform binary with tofu and run tofu init. Migration is straightforward for standard configurations.

What license does OpenTofu use?+

OpenTofu uses the MPL-2.0 (Mozilla Public License 2.0) license, which is a permissive open-source license. This was the original license used by Terraform before HashiCorp switched to the Business Source License.

What is state encryption in OpenTofu?+

State encryption encrypts your Terraform state file at rest, protecting sensitive values like passwords and API keys stored in state. OpenTofu supports multiple encryption methods including AES-GCM with PBKDF2 key derivation.

Who maintains OpenTofu?+

OpenTofu is maintained under the Linux Foundation with contributions from multiple companies and individual contributors. It has a community-driven governance model rather than being controlled by a single company.

Can I use Terraform modules with OpenTofu?+

Yes. OpenTofu is compatible with Terraform modules from the Terraform Registry and private module registries. Most modules work without modification.

Referencias (3)

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados