PyCharm's Cloud Code plugin will let me run and deploy Google Cloud Run services. However, when I try to set up a local configuration, I am not sure how to specify my Google Application Credentials.
I know how to mount this via the command line using docker run
, but I don't know how to specify the service account. There is a "service account" field, in which I have input both the path to the key file, as well as the email address of the service account (neither work)
I'm a Developer Advocate with the Cloud Code team. Without knowing the error you're getting, it's hard to tell if this is an IAM or auth config issue.
In the config, adding the email address of your service account to the "Service Account" field should do the trick here.
I just tested this by doing the following:
Once the service was running, I opened the URL in the Event Log and the translate API was called successfully.
Alternatively, you could add your service account's key.json
file to your project, create a new environment variable in your Dockerfile named GOOGLE_APPLICATION_CREDENTIALS
, and set that variable equal to the path of your key.json
file.
Reference:
https://cloud.google.com/code/docs/intellij/developing-a-cloud-run-app https://cloud.google.com/run/docs/configuring/service-accounts