-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update set up script, adjust README accordingly
Signed-off-by: Avery Blanchard <[email protected]>
- Loading branch information
Avery Blanchard
committed
Jul 20, 2022
1 parent
28adc09
commit 92bf857
Showing
2 changed files
with
27 additions
and
19 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
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 |
---|---|---|
@@ -1,9 +1,24 @@ | ||
#!/bin/sh | ||
echo "Exporting playbook environment variables..." | ||
export GCP_PROJECT= "test" # ID of GCP project | ||
export GCP_CRED_KIND="serviceaccount" | ||
export GCP_CRED_FILE= # path to service account file | ||
export GCP_CRED_EMAIL= # service account email | ||
export GCP_ZONE= # zone for GCP instance, ex "northamerica-northeast1-a" | ||
export GCP_REGION= # region for GCP instance, ex "northamerica-northeast1" | ||
echo "Complete" | ||
usage() { | ||
echo "Warning: this script parses the GCP service account credential file for the email and project ID." | ||
echo "Usage: ./set_env_var.sh <path to JSON cred file> <GCP region> <GCP zone>" | ||
} | ||
if [[ ($# -ne 3) || ($@ == "--help") || ($@ == "-h") ]] | ||
then | ||
usage | ||
exit 1 | ||
fi | ||
echo "Warning: this script parses the GCP service account credential file for the email and project ID." | ||
sleep 5 | ||
export GCP_REGION="$2" | ||
echo "GCP REGION is set to $GCP_REGION" | ||
export GCP_ZONE="$3" | ||
echo "GCP ZONE is set to $GCP_ZONE" | ||
export GCP_CRED_FILE="$1" | ||
echo "GCP CRED FILE is set to $GCP_CRED_FILE" | ||
export GCP_PROJECT="$(sed -e 's/^"//' -e 's/"$//' <<< "$(jq .project_id $1)")" | ||
echo "GCP PROJECT is set to $GCP_PROJECT" | ||
export GCP_CRED_KIND="serviceaccount" | ||
echo "GCP CRED KIND is set to $GCP_CRED_KIND" | ||
export GCP_CRED_EMAIL="$(sed -e 's/^"//' -e 's/"$//' <<< "$(jq .client_email $1)")" | ||
echo "GCP CRED EMAIL is set to $GCP_CRED_EMAIL" |