Skip to main content

tfmigrate

About tfmigrate, please see https://github.com/minamijoyo/tfmigrate .

You can introduce tfmigrate to Terraform Workflow easily with tfaction.

  1. Create .tfmigrate.hcl and migration file in the working directory
  2. Create a Pull Request with label tfmigrate:<target>

tfmigrate plan is run in the pull request CI, and tfmigrate apply is run in the main branch.

The label prefix tfmigrate: can be changed in the configuration file tfaction-root.yaml.

label_prefixes:
tfmigrate: "migrate:"
skip: "skip:"

tfmigrate plan is run.

image

tfmigrate apply is run.

image

multi_state migration

If you migrate resources from the target A to the target B using tfmigrate's multi_state.

  1. Create .tfmigrate.hcl and migration file in the working directory A
  2. Create a Pull Request with label tfmigrate:<target A> and skip:<target B>

Or

  1. Create .tfmigrate.hcl and migration file in the working directory B
  2. Create a Pull Request with label tfmigrate:<target B> and skip:<target A>

The label skip:<target> is important to prevent terraform plan and terraform apply from being run.

Scaffold migration pull request

It is a little bothersome to write migration file. You can scaffold migration pull request by GitHub Actions.

workflow

image

image

💡 Skip creating pull requests

If you don't want to create pull requests by GitHub App, please see Support skipping creating pull requests.