Created
May 23, 2019 18:35
-
-
Save akiatoji/b561bb138d87218666f5459819e9cc1d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
gcloud services enable cloudkms.googleapis.com | |
KEYRING=keyring | |
KEY=secrets | |
gcloud kms keys list --location global --keyring $KEYRING | |
if [[ $? -ne 0 ]]; then | |
gcloud kms keyrings create ${KEYRING} --location global | |
gcloud kms keys create ${KEY} --location global \ | |
--keyring ${KEYRING} --purpose encryption | |
fi | |
rm -f secrets.cfg.encrypted | |
gcloud kms encrypt --location global \ | |
--keyring ${KEYRING} \ | |
--key ${KEY} \ | |
--plaintext-file secrets.cfg \ | |
--ciphertext-file secrets.cfg.encrypted | |
gsutil cp sectets.cfg.encrypted gs://vault |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment