Ben Hall
Ben Hall

Reputation: 2037

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

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?

Upvotes: 3

Views: 4024

Answers (2)

Marilu
Marilu

Reputation: 392

Enabling APIs requires a higher responsibility. The compute.instanceAdmin.v1 the role doesn't allow users to enable APIs.

If you are the owner and have enabled the GCE API, it might take a few minutes before the users can access GCE, as some resources need to be configured on the project like the default network, firewalls, and routes.

To enable APIs in a project, the minimum role required is project editor.

Upvotes: 1

Zachary Newman
Zachary Newman

Reputation: 21404

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.

Upvotes: 4

Related Questions