3

Gcloud returned the following error when attempting to create the instance on GCE. The command was initiated from a GCE instance with the scope set to 'Full API access to all Google cloud services' and has project-wide SSH keys blocked.

ERROR: (gcloud.compute.instances.create) Some requests did not succeed: 
- Required 'compute.subnetworks.use' permission for 'projects/[project-name]/regions/[region]/subnetworks/default'

Any help would be greatly appreciated. I couldn't find any resource anywhere on that error.

stambata
  • 1,668
  • 3
  • 14
  • 18
sunnyyip
  • 31
  • 1
  • 4
  • Is this still happening? If so, make sure that you have the latest gcloud version. Additionally run ¨gcloud auth list¨ and ¨gcloud config list¨ to verify the credentials that gcloud SDK is using. A good test to troubleshoot is deploying different resources in different zones and regions. – Carlos Nov 17 '16 at 21:09
  • Were you ever able to solve this issue? If so please consider posting a self-answer so the community can benefit. – Faizan Feb 17 '17 at 18:41

2 Answers2

3

Carlos has good suggestion in the comment. Posting them as an answer for other user's looking for help:

  • Make sure you have the latest gcloud version installed. You can run gcloud version to see the version and gcloud components update to update.
  • You can run gcloud auth list and gcloud config list to verify gcloud is authenticated with the correct user/service account.
  • To debug further you can deploy the instance in different network and zone.
Faizan
  • 1,438
  • 10
  • 18
1

you need to add permissions to the project that network is in, so

gcloud projects add-iam-policy-binding YOUR_NETWORK_PROJECT_ID_HERE --role roles/compute.networkUser     --member serviceAccount:YOUR_SERVICE_ACCOUNT_EMAIL_ADDRESS_HERE
Matt
  • 11
  • 2