Skip to content

Instantly share code, notes, and snippets.

@ianmaddox
Last active October 29, 2021 23:05
Show Gist options
  • Save ianmaddox/8da26b08a05d9552842c2b594b6a2432 to your computer and use it in GitHub Desktop.
Save ianmaddox/8da26b08a05d9552842c2b594b6a2432 to your computer and use it in GitHub Desktop.
GCP Secret Manager getsecret.sh
#!/usr/bin/env bash
PROJECTID=sm-demo-330516
if [ -z "$1" ]; then
echo "Usage:"
echo " $0 SECRET_NAME"
exit
fi
SEC="$(hostname)-$1"
gcloud beta secrets versions access latest --project=$PROJECTID --secret=$SEC | xargs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment