Skip to content

Terraform & Helm: Terraform: state

6 Terraform & Helm commands: Terraform: state. Click a command to see what each part does.

Index
6 items
Click a command to see what each part does.

Terraform: state6

  • terraform state list | grep <name>Find a resource in state

    What each part does

    1. state listevery resource address in the state
    2. | grep <name>keep matching addresses
  • terraform state show <address>Inspect one resource

    What each part does

    1. state show <address>all attributes stored for that resource
  • terraform state mv <old-address> <new-address>Rename/move without destroyingCaution

    What each part does

    1. state mvchange the address in state (e.g. after refactoring into a module)

    Tip Newer alternative: a moved {} block in code.

  • terraform state rm <address>Stop managing a resource (keep it in the cloud)Caution

    What each part does

    1. state rmforget the resource; the real object is NOT deleted
  • terraform output -raw <name>Read an output for scripts

    What each part does

    1. output <name>print an output value
    2. -rawplain string without quotes (for shell variables)
  • terraform force-unlock <lock-id>Release a stuck lockDestructive

    What each part does

    1. force-unlock <lock-id>remove a lock left by a crashed run (ID is in the error message)

    Tip Make sure nothing else is running against this state.

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…