Skip to content

cla import-plan - show what an import would do

cla import-plan: works out what cla import would change, and changes nothing.

It is the same pipeline as cla import with the apply step simply never constructed, so what it shows is what an import would actually do rather than a separate estimate of it.

Usage

cla import-plan <files|dirs>... [--out plan.json] [--diff]
                [--allow-missing] [--lax] [--prune] [--secret-key KEY]

With no paths, ./cla-objects/<env> is read — cla -c prod import-plan reads ./cla-objects/prod.

--internal and --no-moved are accepted too, and behave as they do on cla import. -y and --dry-run are accepted and have no effect, since nothing that could write is ever constructed.

Output

  1. CREATE    generic_server.back-office (15 attrs)
  2. UPDATE    generic_server.front-desk (1 attr)
1 create, 1 update, 2 unchanged

--diff adds the old and new value of every attribute that changes.

Saving a plan

--out plan.json writes the plan as JSON: every address, its action, and its attribute changes. The file is stable — the same configuration and the same files always produce the same JSON — so it can be committed, reviewed, or attached to a change request.

Exit codes

  • 0 — the plan is clean, whether or not it contains changes.
  • 2 — the files could not be read or understood, or the plan has conflicts.

That makes it useful in a pipeline that has to fail on a bad file but not on a pending change. To fail when there is anything to do, use cla diff instead, which returns 1 when there are differences.

Examples

Review before applying:

cla import-plan ./cla-objects --diff
cla import ./cla-objects

Keep a record of a migration:

cla import-plan ./cla-objects --out migration-plan.json

See also

Clarive HCL for the language and Command line for the workflows.