I have two projects in GCP, let’s say project A and B. Project A is newly created, and project B is two years old. When I create a cloud function in project A, it’s created with the default services account (project@appspot…). However, when I create a cloud function on project B, a non existing service account is used. I know it doesn’t exist because it doesn’t appear on the IAM.
In the project A the cloud function created can access the datastore, however, the same cloud function in the project B isn’t able to access the datastore.
So, my questions are:
How can I know which google services account will be used by a cloud function?
Is there a way to change the used service account by project B to have a cloud function that access the datastore?
I have tried to give the appropriate permissions to the cloud function, but as long as is in project B it doesn’t work. What am I missing here?