Skip to content

Instantly share code, notes, and snippets.

@eyalzek
Created August 18, 2016 09:09
Show Gist options
  • Save eyalzek/04ffc30699a9e59ac33e131b8edffe8b to your computer and use it in GitHub Desktop.
Save eyalzek/04ffc30699a9e59ac33e131b8edffe8b to your computer and use it in GitHub Desktop.
#!/bin/bash -ex
ENV=staging
for resource in `terraform state list -state=terraform.tfstate |grep $ENV`
do
echo $resource
terraform state mv -state=terraform.tfstate -state-out="$ENV-test.tfstate" $resource $resource
done
# rm *.backup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment