when I put in the command
gcloud comput ssh myhappyvm
it asks me for the zone and when I type yes, it gives me the above error
ERROR: (gcloud.compute.ssh) Could not fetch resource:
- Failed to find project value
This issue happens, if the VM is created in Zone-1 and you are trying to SSH the VM in Zone-2. As a best practice, it is better to set configuration (compute/zone) to the zone where VM is created or us parameter "–zone
Here is a sample test commands to re-create the issue and a proper fix:
Create test-vm in us-east1-b zone using following command
gcloud compute instances create test-vm --zone=us-east1-b --machine-type=n1-standard-1 --subnet=default
Trying to SSH with setting configuration or "–zone" parameter. Getting the same error as you are getting.
**gcloud compute ssh test-vm** Did you mean zone [us-east1-c] for instance: [test-vm] (Y/n)? y ERROR: (gcloud.compute.ssh) Could not fetch resource: - The resource 'projects/playground-s-11-5aa0ad1e/zones/us-east1-c/instances/test-vm' was not found cloud_user_p_9e74b613@cloudshell:~ (playground-s-11-5aa0ad1e)$
Trying to SSH again with "–zone" parameter
**gcloud compute ssh --zone us-east1-b test-vm** Linux test-vm 4.19.0-13-cloud-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Mon Jan 4 14:50:26 2021 from 188.8.131.52 cloud_user_p_9e74b613@test-vm:~$
Please note that the very first time you SSH using gcloud command, it may ask you for a passphrase, you can just press enter and move forward.
Hope this helps!