Created
April 16, 2021 01:14
-
-
Save codeweft/2dd50dac3ae0dc2f69ab6ac954d4eded to your computer and use it in GitHub Desktop.
Pulumi CLI #6029 - Be able to use multiple accounts simultaneously on linux
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
#!/usr/bin/env bash | |
set -Eeuo pipefail #https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ | |
trap "usage: pulumi-profile <personal|work>" ERR | |
# Context: https://github.com/pulumi/pulumi/issues/6029 | |
# Set token values and move this script to /usr/bin or $PATH to have direct access from cli | |
if [ -z ${1+x} ]; then | |
echo "usage: pulumi-profile <personal|work>" | |
exit 0 | |
fi | |
profile_name="$1" | |
pulumi logout | |
if [[ "${profile_name}" == "personal" ]]; then | |
export PULUMI_ACCESS_TOKEN="pul-personal-token" | |
elif [[ "${profile_name}" == "work" ]]; then | |
export PULUMI_ACCESS_TOKEN="pul-work-token" | |
else | |
echo "usage: pulumi-profile <personal|work>" | |
exit 0 | |
fi | |
pulumi login |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment