Last active
February 8, 2021 13:20
-
-
Save jboero/5ea883248d701319d3564698cb29a603 to your computer and use it in GitHub Desktop.
TFE migrate ORG
This file contains hidden or 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
#!/bin/bash | |
export ATLAS_TOKEN={YOURTOKEN} | |
export OLD_ORG={YOUROLDORG} | |
export NEW_ORG={YOURNEWORG} | |
for ws in $(tfe workspace list) | |
do | |
tfe pullvars -name "$OLD_ORG/$ws" > $ws.vars | |
tfe pullvars -name "$OLD_ORG/$ws" -env true > $ws.env | |
done | |
tfe pushvars -name "$NEW_ORG/$ws" -var-file $ws.json | |
for f in *.env | |
do | |
for line in $(cat $f) | |
do | |
tfe pushvars -env true -tfe-org "$NEW_ORG" -tfe-workspace "$OLD_ORG" -env-var $line | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment