-
-
Save rimusz/2f2432fad0a67ddd36cd4f81fb731e6b to your computer and use it in GitHub Desktop.
gcloud decrypt
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
| #!/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 "gcloud 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