kl import, kl export, and kl list

These commands cover the “what states do I have?” and “how do I move them?” layer.

For ordinary backend changes of plain Terraform state, vanilla Terraform already does the job well with terraform init -migrate-state. That is still the normal path when you are simply moving the current raw tfstate from one backend to another.

kl import and kl export are more useful when you want operator-oriented state onboarding or extraction outside the usual backend-reconfiguration flow, and they become especially relevant for KiloLock-native import/export where history, tags, and other native metadata matter beyond the current raw state snapshot.

kl import

kl import loads state into KiloLock.

Standard Terraform state import

kl import terraform.tfstate --name example

Use this when onboarding an existing state into KiloLock.

Import from stdin

cat terraform.tfstate | kl import - --name example

Native KiloLock payload import

kl import history.json --name example --native

Use native mode when the payload already includes KiloLock-native history and metadata.

kl export

kl export writes the current version of a state back out.

Export to stdout

kl export example

Export to a file

kl export example -o exported.tfstate

Export native KiloLock payload

kl export example --native -o example-native.json

Use native export when you want more than the current raw Terraform state.

kl list

kl list enumerates stored states with summary stats.

Example

kl list

Use it when:

  • you are orienting yourself in a new environment
  • you want a fast inventory of managed states
  • you want to confirm import succeeded

Common workflow

kl import terraform.tfstate --name example
kl list
kl export example -o example.tfstate

That sequence is the fastest way to validate import, presence, and export behavior end to end.