OpenTofu — Operations¶
Scope
Production deployment patterns, operational procedures, performance tuning, and troubleshooting for OpenTofu.
Deployment¶
Installation¶
# Install via package manager
brew install opentofu
# or
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sh
# Verify
tofu version
Migration from Terraform¶
# In existing Terraform directory
tofu init -upgrade # Reinitializes providers
tofu plan # Should match existing Terraform plan
Drop-in Replacement
OpenTofu is a drop-in replacement for Terraform < 1.6. State files, HCL configs, and providers are compatible. Replace terraform with tofu in all commands.
State Management¶
# State operations (same as Terraform)
tofu state list
tofu state show <resource>
tofu import <resource> <id>
tofu state mv <source> <dest>
Key Differences from Terraform¶
| Feature | OpenTofu | Terraform |
|---|---|---|
| License | MPL 2.0 (open source) | BSL 1.1 (source-available) |
| State encryption | Native (local + remote) | Terraform Cloud only |
| Registry | registry.opentofu.org | registry.terraform.io |
| Provider locking | Compatible | Compatible |
Common Issues¶
| Issue | Fix |
|---|---|
| Provider not found | Add registry.opentofu.org mirror or use required_providers block |
| State encryption setup | tofu init with encryption block in backend config |
| Module incompatibility | Check for Terraform Cloud-specific features |