This repository has been archived by the owner on Dec 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Manage sensitive information to Google Cloud Secret Manager
tpAtalas edited this page Mar 25, 2023
·
2 revisions
Secret Manager allows you to store, manage, and access secrets as binary blobs or text strings. With the appropriate permissions, you can view the contents of the secret.
More Info: Secret Manager conceptual overview
- How to create Secret Manager and add secret value to Secret Manager
- How to update secret during deployment to Google Cloud Run
- How to delete the Secret from Secret Manager
- Go to your project
- Create a secret to Secret Manager
# gcloud secrets create [secret_name] --replication-policy="automatic"
gcloud secrets create example-secrets --replication-policy="automatic"
- Add a secret value with file
the file must contain the value only
# gcloud secrets versions add [secret_name] --data-file=[file_name]
gcloud secrets versions add example-secrets --data-file=secret-mongodb-uri
# you may run this command while deploying
# --update-secrets ENVIRONMENT_VARIABLE_NAME=SECRET_NAME:VERSION
gcloud run deploy \
--update-secrets MONGODB_URI=example-secrets:latest
- Check the current secret
gcloud secrets list
- Delete the secret
# gcloud secrets delete SECRET_NAME
gcloud secrets delete example-secret