Open Temikus opened 4 years ago
I just tried to use this in a new GCP project where I forgot to add my public SSH key as project metadata and starting a new instance was hanging forever on:
==> default: Waiting for instance to become "ready"...
==> default: Machine is booted and ready for use!
==> default: Waiting for Communicator to become available...
...until I terminated it manually.
Is this the same problem or a similar one but in a different provisioning stage, @Temikus ?
I did https://github.com/mitchellh/vagrant-google/pull/258 as a weak workaround, to prevent other people from wasting time the same way (I think that the best solution would be to implement validation for this in the plugin code. But it looks like fog-google does not have "get_project_SSH_keys" implemented and I don't feel strong enough in Ruby to implement that there and then using it here.)
@gdubicki thanks for your comment, I realized that I did not hit the save button on the ssh key in the dashboard, looks like we need a timeout as this is suggesting
Hello to all, I found a workaround for the connection to be established, I had to set the variable override.ssh.host with an IP address.
I saw that this value was not filled in after running a vagrant up --debug.
For the moment I set the ip in hard because I haven't found a way to do it with a variable or dynamically
below the code :
Vagrant.configure("2") do |config|
config.vm.box = "gce"
config.vm.provider :google do |google, override|
google.google_project_id = "your-project-id"
google.google_json_key_location = "cred.json"
google.image_family = 'rocky-linux-9'
google.image_project_id = 'rocky-linux-cloud'
google.name = "develvagrant"
google.zone = "europe-west4-a"
google.machine_type = "n2-standard-2"
google.disk_size = 30
google.network = 'lz-network'
google.subnetwork = 'lz-subnetwork-eemshaven'
google.external_ip = false
google.tags = ['internet', 'ssh', 'europe-west-4']
google.network_ip = '1.2.3.4'
override.ssh.host = '1.2.3.4'
override.ssh.username = "tstvagrantfrt"
override.ssh.private_key_path = "id_rsa"
end
end
Well this is embarassing, see
run_instance.rb
:We need to add some communication and a timeout here.