Skip to content

Instantly share code, notes, and snippets.

@vancluever
Last active April 15, 2017 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vancluever/47fa75a53cb063db09f9a42cfbf96252 to your computer and use it in GitHub Desktop.
Save vancluever/47fa75a53cb063db09f9a42cfbf96252 to your computer and use it in GitHub Desktop.
Switch env for TF v0.9.0 and higher (composite env w/region)
if ! env_list="$(terraform env list)"; then
exit 1
fi
if [[ "${env_list}" == *"${ENV}_${REGION}"* ]]; then
terraform env select "${ENV}_${REGION}"
else
terraform env new "${ENV}_${REGION}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment