Deploying to Cloud Run with a custom service account failed with iam.serviceaccounts.actAs error
If we read the docs in detail for the IAM Reference page for Cloud Run which is found here, we find the following text:
A user needs the following permissions to deploy new Cloud Run services or revisions:
run.services.create
andrun.services.update
on the project level. Typically assigned through theroles/run.admin
role. It can be changed in the project permissions admin page.iam.serviceAccounts.actAs
for the Cloud Run runtime service account. By default, this is[email protected]
. The permission is typically assigned through theroles/iam.serviceAccountUser
role.
I think these extra steps explain the story as you see it.
Adding Cloud Run Admin and Service Account User roles to my own service account fixed this for me. See step 2 in the docs here: https://cloud.google.com/run/docs/continuous-deployment#continuous