"You don't have permission to enable Compute Engine" with GCloud

gcloud, google-compute-engine

Solution

Is there a way to automate enabling Compute Engine for a project?

With the Cloud SDK installed,

$ gcloud service-management enable --project foo compute-component.googleapis.com

should do the trick. Otherwise, you can invoke Google Service Management via some other method.

Or, is there a role I can add the user to enable it?

From the API docs:

Authorization requires the following Google IAM permission on the specified resource `service_name`:

servicemanagement.services.bind

Offhand, I don't know which roles have that permission.

Problem

I've created a new project for a user and given them the role of `Compute Instance Admin`. However, when they first load the project they are getting the error " You don't have permission to enable Compute Engine. As the owner, I need to visit the Compute page for the project to initialize it. At which point, users can then access Google Compute. Is there a way to automate enabling Compute Engine for a project? Or, is there a role I can add the user to enable it?

Original source