I am following https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule. When testing the Cloud Function, I get the error message:
Error: Required 'compute.instances.list' permission for 'projects/thorstenstaerk-cert' at Function.parseHttpError (/workspace/node_modules/google-gax/build/src/googleError.js:59:37) at decodeResponse (/workspace/node_modules/google-gax/build/src/fallbackRest.js:72:49) at Promise.all.then (/workspace/node_modules/google-gax/build/src/fallbackServiceStub.js:90:42) at process._tickCallback (internal/process/next_tick.js:68:7)
Now, I recall I have to give this permission to the default service account of Cloud Functions, but where do I find it? It's not in IAM.
I got my issue resolved following https://cloud.google.com/functions/docs/securing/function-identity.
As I am using 1st generation Cloud Functions it went this way:
Now the Cloud Function works for me.