OpenTofu: A Beginners Guide to a Terraform Fork Including Migration From Terraform
OpenTofu Beyond Basics
Migrating existing Terraform configuration to OpenTofu
OpenTofu 1.6 is fully compatible with Terraform 1.6, making it easy to switch your existing infrastructure-as-code workflows. This guide walks you through a safe, step-by-step migration and provides tips for rollback and troubleshooting.
Prerequisites
- Terraform 1.6.x installed
- Access to your Terraform state file (
terraform.tfstate) - A version-control backup or snapshot of your configuration
Step-by-Step Migration
Document a disaster recovery plan
Outline rollback procedures and how to restore state in case of unexpected issues.Apply any pending Terraform changes
terraform init terraform plan terraform applyInstall OpenTofu
Follow the official installation guide for your OS: OpenTofu Installation.Backup your Terraform state file
Note
Always version-control or copy your
terraform.tfstatebefore you begin.cp terraform.tfstate terraform.tfstate.backupInitialize OpenTofu and preview the plan
tofu init tofu planTest a non-critical change
Modify a minor resource to verify compatibility:# Example: Update a tag on a test resource tofu applyConfirm that resources apply without drift before proceeding to production.

Getting Community Support
If you encounter issues during migration, leverage the OpenTofu community:
- Join the OpenTofu Slack for real-time assistance.
- Post in GitHub Discussions under “Q&A.”

If you need to revert to Terraform—whether due to workflow preference or compatibility issues—follow these steps:
Backup your OpenTofu state
Warning
Skipping this step may lead to state loss. Always keep a backup.
cp terraform.tfstate terraform.tfstate.backupRe-initialize Terraform
terraform initReview the execution plan
terraform planApply a test change
terraform applyEnsure the rollback completes successfully before normal operations.

When you discover a bug in OpenTofu—during migration or rollback—please file a report on OpenTofu GitHub Issues. Include:
| Report Type | Description |
|---|---|
| Bug report | Steps to reproduce, expected vs. actual behavior |
| Feature request (RFC) | Rationale, proposed API changes |
| Security vulnerability | Version details, impact analysis (use private channels) |
Before You File
Search existing issues first and follow the issue templates.

Links and References
- OpenTofu Documentation
- Terraform 1.6 Release Notes
- OpenTofu GitHub Repository
- Terraform Configuration Language
Watch Video
Watch video content