Skip to content

tfcensus move suggest ​

suggest plans each --from and --to unit through terragrunt (one at a time, against its backend, without the state lock) and pairs every resource a --from unit plans to delete with the resource a --to unit plans to create. A pair is a move when the type is the same, every attribute known before apply is equal, and neither resource matches anything else. Null equals an empty string, list or map. Replaced resources and data sources never take part. Name a unit in both --from and --to to find renames inside it.

--ignore lets one attribute differ, with tfautomv's syntax: everything:TYPE:ATTR, whitespace:TYPE:ATTR, prefix:TYPE:ATTR:PREFIX, plus json:TYPE:ATTR, which compares JSON strings by value. TYPE may be *. ATTR is a flat key such as tags.Name or ingress.0.cidr_blocks.#; a * segment matches any one segment, and a rule covers the keys below its ATTR.

The draft goes to stdout, or to --draft. It holds one migration "units" block per source unit and one block of mv actions per unit whose addresses change. suggest writes no state; check the draft with tfcensus move plan. --plan-dir reads <dir>/<unit>/tfplan.json instead of running terragrunt, the layout of terragrunt run --all --json-out-dir.

Usage ​

sh
tfcensus move suggest --from <unit> --to <unit> [flags]

Arguments ​

ArgumentRequiredRepeatable
unityesno
unityesno

Flags ​

FlagDescriptionTypeDefaultValuesConfig keyNotes
--draftwrite the draft migration file here instead of stdoutstring
--forceoverwrite an existing --draft filebool
--fromunit whose planned deletes can be moved, as path or path:workspace (repeatable)string, repeatablerequired
--ignorelet an attribute differ: KIND:TYPE:ATTR[:PREFIX] (repeatable)string, repeatable
--plan-dirread plans from <dir>/<unit>/tfplan.json instead of running terragruntstring
--reporepository root that unit paths are relative tostring.
--tounit whose planned creates can receive a move, as path or path:workspace (repeatable)string, repeatablerequired

The global flags work with every command.

Output formats ​

--format accepts tty, plain, json. 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.
130Interrupted by Ctrl-C (SIGINT) or a cancelled context.

All codes are listed on the exit codes page.

Examples ​

sh
tfcensus move suggest --from live/network --to live/network-sg --to live/network-endpoints
tfcensus move suggest --from live/app --to live/app --ignore json:aws_iam_policy:policy --draft migrations/app.hcl