Created
August 1, 2017 12:57
-
-
Save nshttpd/58de3e76d479b0576eaccb4e9cb9ac5c to your computer and use it in GitHub Desktop.
gcloud decrypt
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
#!/bin/bash | |
set -e | |
GCP_PROJECT="${GCP_PROJECT:-default}" | |
KMS_KEYRING="${KMS_KEYRING:-default}" | |
KMS_LOCATION="${KMS_LOCATION:-default}" | |
KMS_KEY="${KMS_KEY:-default}" | |
hash gcloud 2>/dev/null || { echo >&2 "glcoud command required to decrypt secrets."; exit 1; } | |
echo "Decrypting : $1" | |
gcloud kms decrypt --ciphertext-file=$1 --plaintext-file=${1%.enc} --key=${KMS_KEY} --keyring=${KMS_KEYRING} --location=${KMS_LOCATION} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment