Created
January 25, 2018 01:34
-
-
Save nathan-muir/9c81eeaed9200d367ab227ccef13b602 to your computer and use it in GitHub Desktop.
Terraform move state between remote backends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get a local copy of the destination project state | |
cd project_dest | |
terraform state pull > remote.tfstate | |
# Move from the SRC project to the DEST project | |
cd ../project_src | |
terraform state mv \ | |
-state-out=../project_dest/remote.tfstate \ | |
module.XYZ module.XYZ | |
# Push the local file to your remote backend (eg S3) | |
cd ../project_dest | |
terraform state push remote.tfstate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment