Created
December 11, 2017 08:47
-
-
Save cobusbernard/cf38f1bbbf9e9b3289f144f1e135d81f to your computer and use it in GitHub Desktop.
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
function get-tfstate() { | |
if [ -z $1 ]; then | |
echo "You must specify the environment!" | |
return | |
fi | |
if [ -z $2 ]; then | |
echo "You must specify the system!" | |
return | |
fi | |
aws --profile <company-prefix>-$1 s3 cp s3://<statefile bucket>/env:/$1/$2/terraform.tfstate ./ | |
cp ./terraform.tfstate ./terraform.tfstate.backup | |
} | |
function set-tfstate() { | |
if [ -z $1 ]; then | |
echo "You must specify the environment!" | |
return | |
fi | |
if [ -z $2 ]; then | |
echo "You must specify the system!" | |
return | |
fi | |
if [ -z $3 ]; then | |
echo "You must specify the statefile to upload!" | |
return | |
fi | |
aws --profile <company-prefix>-$1 s3 cp --acl bucket-owner-full-control $3 s3://<statefile bucket>/env:/$1/$2/terraform.tfstate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment