Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google cloud compute not recognizing any resources

I've been playing around with the google cloud compute platform and everything was fine until all of a sudden last night it seemed unable to recognize any resources. Whenever I try to do anything, for example list current instances, I get:

$ gcloud compute instances list

ERROR: (gcloud.compute.instances.list) Some requests did not succeed:
 - The resource 'projects/myProject' was not found

Everything seems to work fine through the web interface. I can launch an instance, look at it, link persistent disks, etc. It's only when I try to work through the command line interface that I have problems. And all of these commands worked fine until last night.

I've tried revoking my credentials and logging in again. I've double checked that my active credentialed account is a valid user on the project I'm trying to access. I've tried creating a new project and accessing that one. I've tried accessing a project that I don't own but on which I am an authorized user. I've even tried deleting the sdk toolkit and re-installing it. Nothing seems to work.

But I can ssh into an active instance just fine with: gcloud compute --project "myProject" ssh --zone "us-central1-a" "instance-1"

Any thoughts? I have no idea what to try next. In case it matters, I'm on OSX.

like image 559
MorganM Avatar asked Sep 04 '14 22:09

MorganM


Video Answer


1 Answers

I have checked what you describe and you are right, you cannot use the project name, you need to use the project ID like in this link or the project number.

I have run this command:

gcloud config set project thisisnotarealproject

And I didn't receive any error. It seems that the gcloud command doesn't check if the project is correct or not. However I have seen with tcpdump that sends some packets and I suspect that this is to check the possible SDK updates and give you the message:

There are available updates for some Cloud SDK components.  To 
install them, please run:
$ gcloud components update

Then, when I type: gcloud config list I can see my fake project correctly configured but that's because that information is stored in the file ~/.config/gcloud/properties.

In fact, if you modify that file and after that you type again gcloud config list you'll see how the value for the project changes.

So, to summarize, you can set the project using the:

  • Project ID
  • Project number

Hope it helps.

like image 92
Adrián Avatar answered Oct 11 '22 15:10

Adrián