What is tfmigrate?
mastertfmigrate is a state migration tool designed for GitOps workflows using Terraform or OpenTofu. It allows you to define Terraform state operations (like mv, rm, import, or replace-provider) declaratively in HCL files. This enables you to commit state changes to version control, plan them to ensure no infrastructure drift occurs, and apply them safely as part of a CI/CD pipeline.
Key features include:
- GitOps friendly: Write state operations in HCL.
- Monorepo support: Easily split or merge
tfstatefiles by moving resources between directories. - Dry run migration: Use
tfmigrate planto simulate operations against a temporary local state to verify thatterraform planshows no changes before touching remote state. - Migration history: Tracks applied migrations to ensure they are executed in sequence.