Set GOOGLE_APPLICATION_CREDENTIALS after activating

pull/6/head
Erick Fejta 2016-08-03 23:24:31 -07:00
parent 40b1e20efd
commit ffe611569d
1 changed files with 2 additions and 0 deletions

View File

@ -258,6 +258,8 @@ fi
if [[ -f "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then if [[ -f "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
echo 'Activating service account...' # No harm in doing this multiple times. echo 'Activating service account...' # No harm in doing this multiple times.
gcloud auth activate-service-account --key-file="${KUBEKINS_SERVICE_ACCOUNT_FILE}" gcloud auth activate-service-account --key-file="${KUBEKINS_SERVICE_ACCOUNT_FILE}"
# https://developers.google.com/identity/protocols/application-default-credentials
export GOOGLE_APPLICATION_CREDENTIALS="${KUBEKINS_SERVICE_ACCOUNT_FILE}"
unset KUBEKINS_SERVICE_ACCOUNT_FILE unset KUBEKINS_SERVICE_ACCOUNT_FILE
elif [[ -n "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then elif [[ -n "${KUBEKINS_SERVICE_ACCOUNT_FILE:-}" ]]; then
echo "ERROR: cannot access service account file at: ${KUBEKINS_SERVICE_ACCOUNT_FILE}" echo "ERROR: cannot access service account file at: ${KUBEKINS_SERVICE_ACCOUNT_FILE}"