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.
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.
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.
How to use
- Install OpenTofu via your package manager or download the binary.
- Replace
terraformcommands withtofucommands. - Initialize your existing Terraform project with
tofu init. - 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'
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"
}
Related on TokRepo
- DevOps tools — Infrastructure as code tools
- Automation tools — Infrastructure automation
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
tofubinary instead ofterraform. 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.
Frequently Asked Questions
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.
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.
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.
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.
Yes. OpenTofu is compatible with Terraform modules from the Terraform Registry and private module registries. Most modules work without modification.
Citations (3)
- OpenTofu GitHub— OpenTofu is the Linux Foundation fork of Terraform
- OpenTofu Docs— OpenTofu state encryption documentation
- Linux Foundation— Linux Foundation project governance
Related on TokRepo
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.