Skip to content

tfcensus move ​

move runs migration files: migration "units" blocks that move resources from one unit's state to others, or run tfmigrate-style mv, xmv and rm actions inside one state. The file format and a full walkthrough are at https://tfcensus.sasskovacs.dev/guides/move.

suggest drafts a migration file from plans. plan and status only read. apply, rollback and mark-applied are the only tfcensus commands that write to a backend; each asks you to type the block's destination unit path first, or takes --yes. Without a terminal and without --yes they exit 2 and change nothing.

Exit codes: 3 when a block is rejected, 4 when the backend credentials fail, 2 for a file or flag error or a missing confirmation, and 1 for any other failure.

Unit paths in the file are relative to --repo (default: the current directory) and name units with an s3 backend. Write path:workspace for a workspace other than default, such as live/app:blue; the state is then read from <workspace_key_prefix>/<workspace>/<key> (env: when the backend sets no prefix), and terragrunt runs with TF_WORKSPACE. The workspace must exist. The native strategy works on the default workspace only.

Usage ​

sh
tfcensus move <command>

The global flags work with every command.

Examples ​

sh
tfcensus move suggest --from live/network --to live/vpc --draft migrations/split_network.hcl
tfcensus move plan migrations/split_network.hcl
tfcensus move apply migrations/split_network.hcl --yes

Subcommands ​

CommandDescription
tfcensus move applyApply a migration file to the units' states
tfcensus move mark-appliedRecord migration blocks as applied without changing state
tfcensus move planVerify a migration file with plans, without writing anything
tfcensus move rollbackRestore the states a migration file changed
tfcensus move statusShow whether each migration block is applied in each unit
tfcensus move suggestDraft a migration file from the moves that plans show