Skip to content


Repository files navigation


Go Reference Build Status Go Report Card GitHub last commit License

Go library to migrate Terraform Configuration and State with terraform state mv and terraform state rm command and hcledit.

Using tfmigrator, you can do the following.

  • migrate resource address
    • e.g. =>
      • terraform state mv
      • hcledit block mv -u -f
    • e.g. =>
  • move resources in a Terraform Configuration file and State to the other file and State
    • e.g. terraform.tfstate => foo/terraform.tfstate
    • e.g. => foo/
  • remove resources from State and Terraform Configuration
    • e.g. terraform state rm
    • e.g. hcledit block rm -u -f

On the other hand, tfmigrator doesn't support the following things.

  • change resource fields (attributes and blocks)
    • e.g. hcledit attribute


  • Go
  • Terraform

hcledit isn't needed.


Please see examples.


Getting Started

The example and README tell us how to use tfmigrator and how tfmigrator works. You can implement a command for migration with Go simply. About the detail of Planner, please see the document of Source and MigratedResource.

QuickRun provides a high level API, so if you use QuickRun, you don't have to know about other API like Runner. But if you need low level API, please check other API like Runner.

Check tfmigrator/cli too

We have implemented CLI with this framework.

Release Note (Change log)