Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud "config set project" works but can't fetch project?

I'm new to gcloud. I've created a project called playground but can't seem to be able to use it. Here are my commands on the terminal

$ gcloud config set project playground
Updated property [core/project].

$ gcloud compute instances create --zone us-west1-a playground-instance
ERROR: (gcloud.compute.instances.create) Could not fetch resource:
- Failed to find project playground

I'm very confused! Could this be an issue with path?

Here is what I've tried.

  1. First I thought maybe its a path issue. I have /Users/macuser/google-cloud-sdk/bin in $PATH. Do I need anything else?

  2. I've insured that the right user is logged in via gcloud auth list and have additionally set it explicitly with gcloud config set account ...

Any advise or suggestions greatly appreciated.


Additional info

$ gcloud config list              
[core]
account = [email protected]
disable_usage_reporting = True
project = playground

Your active configuration is: [playground]
like image 626
Babakness Avatar asked Oct 25 '17 21:10

Babakness


1 Answers

GCP projects have several different identifiers:

  • "project number" is a unique 12 digit number assigned to each project
  • "project ID" is a unique alphanumeric ID you can chose when creating a project, but can't be changed. This often defaults to something like obvious-animal-1234.
  • "project name" which is a freeform text string you can choose and change at will.

You should use the project ID with gcloud.

It is possible "playground" is actually the project name, and not it's ID. Run gcloud projects list to see a list of projects and their ID/number/name to verify you are using the right identifier.

like image 99
David Avatar answered Sep 29 '22 01:09

David