Skip to content

Instantly share code, notes, and snippets.

@thomaslagies
Last active May 8, 2023 15:35
Show Gist options
  • Select an option

  • Save thomaslagies/7570387ef8df96b1e60dcc3bf993bb49 to your computer and use it in GitHub Desktop.

Select an option

Save thomaslagies/7570387ef8df96b1e60dcc3bf993bb49 to your computer and use it in GitHub Desktop.
terraform state rm

Grep wanted resources:

terraform state list | grep -i <value> > list.txt

IMPORTANT

Edit this list! Make sure you know what you do before running the next command!

# This will remove all resources, line by line, from list.txt
cat list.txt | while read i; do terraform state rm $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment