-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #399 from hashicorp/aw/setup-envvars
Add helper script to setup envvars via envchain
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash -e | ||
|
||
# setup-test-envvars.sh | ||
# | ||
# A helper script that uses envchain (https://github.com/sorah/envchain) to set environment variables for tests. | ||
# It's required to have TFE_ADDRESS and TFE_TOKEN set, the others are optional. | ||
# | ||
type envchain >/dev/null 2>&1 || { echo >&2 "Required executable 'envchain' not found - install it via 'brew install envchain'. Exiting."; exit 1; } | ||
|
||
echo "Set environment variables (envvars) for running tests locally" | ||
echo " envchain will prompt you for values for 4 envvars" | ||
echo " TFE_ADDRESS and TFE_TOKEN are required, the others are optional," | ||
echo " press 'return' to skip them" | ||
echo "" | ||
|
||
read -p "Enter the namespace you want to use in envchain [go-tfe]: " namespace | ||
namespace=${namespace:-go-tfe} | ||
envchain --set ${namespace} TFE_ADDRESS TFE_TOKEN GITHUB_TOKEN GITHUB_POLICY_SET_IDENTIFIER | ||
echo "Done! To see the values: envchain ${namespace} env" |