Skip to content

tfcensus move apply ​

This command writes to S3 or DynamoDB. Every other command is read-only: see the safety model.

apply plans and verifies each pending block like plan, then asks you to type the block's last destination unit path (its from path for an in-place block). It checks that no state changed since it was read, pushes the destinations and then the source with terragrunt run -- state push (so terraform takes the lock and checks lineage and serial), and records the S3 version IDs in each unit's <key>.tfcensus-migrations.json. Blocks already applied are skipped.

A native block writes moves_tfcensus_<block>.tf into each unit (import blocks in destinations, removed blocks in the source), then plans each unit to check the files. It changes no state and no history; run mark-applied after your normal apply.

apply needs bucket versioning (S3-VER). Exit codes: 3 when a block is rejected, 4 when the backend credentials fail, and 2 for a file or flag error, or with no terminal and no --yes.

Usage ​

sh
tfcensus move apply <migration-file> [flags]

Arguments ​

ArgumentRequiredRepeatable
migration-fileyesno

Flags ​

FlagDescriptionTypeDefaultValuesConfig keyNotes
--blockrun only these blocks (default: all, in file order)list, repeatable
--forceoverwrite moves_tfcensus_<block>.tf files of native blocksbool
--reporepository root that the file's unit paths are relative tostring.
--varset var.NAME in the migration file, as NAME=VALUEstring, repeatable
--yesdon't ask for confirmationbool

The global flags work with every command.

Output formats ​

--format accepts tty, plain, json, sarif. Without it, the format is tty when stdout is a terminal and plain otherwise. Formats are described on the global flags page.

Exit codes ​

CodeMeaning
0The command finished. With --fail-on, nothing matched.
1The command failed: a read, a write, a child process or a check failed.
2Wrong usage: an unknown command or flag, a bad value or argument, an invalid config file, or a prompt with no terminal.
3A --fail-on gate matched. The report is still written.
4Credentials were missing or rejected for every source the command needed.
130Interrupted by Ctrl-C (SIGINT) or a cancelled context.

All codes are listed on the exit codes page.

Examples ​

sh
tfcensus move apply migrations/split_network.hcl
tfcensus move apply migrations/split_network.hcl --block split_network --var env=prod