Created
August 1, 2017 12:54
-
-
Save nshttpd/ee78529256c3061d2e2fb0452b99479f to your computer and use it in GitHub Desktop.
gcloud encrypt
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 encrypt secrets."; exit 1; } | |
echo "Encrypting : $1" | |
gcloud kms encrypt --ciphertext-file=$1.enc --plaintext-file=$1 --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