Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Terraform UndoNew to Visual Studio Code? Get it now.
Terraform Undo

Terraform Undo

himanshu

|
1 install
| (1) | Free
Undo terraform apply by snapshotting state before each apply and restoring on demand
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Terraform Undo

Undo a terraform apply by snapshotting state before each apply and restoring on demand.

How it works

Before every apply the extension runs terraform state pull and saves the state JSON to a local .tf-undo/ directory. On undo it pushes the saved state back with terraform state push -force and re-runs terraform apply so infrastructure is reconciled back to the pre-apply configuration.

Commands

Command Description
Terraform: Apply (with Undo) Snapshot state, then run terraform apply
Terraform: Undo Last Apply Restore the most recent snapshot
Terraform: Plan Run terraform plan
Terraform: Show Undo History Open the sidebar history view

The sidebar tree view lists all snapshots with inline undo-to and delete buttons.

Settings

Setting Default Description
tf-undo.terraformPath terraform Path to terraform binary
tf-undo.maxSnapshots 20 Maximum snapshots to keep
tf-undo.autoApprove false Pass -auto-approve to apply
tf-undo.snapshotDir .tf-undo Directory for snapshots (relative to workspace)
tf-undo.confirmUndo true Confirm before undoing

Notes

  • Add .tf-undo/ to your .gitignore — state files can contain sensitive data.
  • The undo dialog offers Undo Apply (push state + apply) or Push State Only (state push only, then you can inspect with terraform plan before applying).
  • Snapshots are trimmed automatically to maxSnapshots.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft