I use Google Source Repository to store my Google Cloud Functions. (Git repo hosted by Google, basically)
One of my function needs to access a private Google Sheet f
My solution when using cloud function with a service account is:
Fetch service account credential json file from Cloud Storage and decrypt it using a Cloud KMS service account which has encrypt/decrypt permission.
Parse service account credential json file at runtime and get private_key
, client_email
and projectId
.
Pass these three secret variables to the client library
We store config variables as environment variables for cloud function, they are plain text, but it's ok. Because they are not secret things.
We must not store secret things like plain text, e.g cloud function environment variables.