Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bastion VM is not reachable after the creation #55

Open
semihkisa opened this issue Jun 3, 2022 · 0 comments
Open

Bastion VM is not reachable after the creation #55

semihkisa opened this issue Jun 3, 2022 · 0 comments

Comments

@semihkisa
Copy link

semihkisa commented Jun 3, 2022

I've been using this code for quite some time and lately I started to get an issue in the step where it's trying to reach the Bastion VM and trying to copy the ssh key.

I don't know whether this is a change in the IBM Cloud for VMware itself or terraform provider but initially when a VM is created with the provided code, the Enable guest customization was enabled by default. It looks like this behavior got changed and when a VM is created it is not enabled default and therefore VM is not accessible from internet at all (I checked the firewall and NAT rule, they seemed OK)

This is the error that I got;

null_resource.setup_ssh (local-exec): ssh: connect to host xx.177.58.57 port 22: No route to host
╷
│ Error: local-exec provisioner error
│ 
│   with null_resource.setup_ssh,
│   on bastion-vm.tf line 354, in resource "null_resource" "setup_ssh":
│  354:   provisioner "local-exec" {
│ 
│ Error running command 'sleep 90
│ echo "waiting 90 seconds for vm to boot"
│ echo "n" | ssh-keygen -t ed25519 -N ''  -f ~/.ssh/id_bastion 
│ ssh-keygen -R xx.177.58.57
│ #ssh-agent bash
│ #ssh-add ~/.ssh/id_bastion
│ sshpass -p password ssh-copy-id -o StrictHostKeyChecking=no -i ~/.ssh/id_bastion root@xx.177.58.57 -f 
│ 
│ ': exit status 1. Output: waiting 90 seconds for vm to boot
│ Generating public/private ed25519 key pair.
│ Your identification has been saved in /root/.ssh/id_bastion
│ Your public key has been saved in /root/.ssh/id_bastion.pub
│ The key fingerprint is:
│ SHA256:PfIYwqMfT5rr4RYG77KgerpBTuCxbnlDn1oA0E6xBfM root@terraform-test-vm1.fyre.ibm.com
│ The key's randomart image is:
│ +--[ED25519 256]--+
│ |..+o.            |
│ |. o=             |
│ |.=. E            |
│ |o = ..   .       |
│ | = o o+ S o      |
│ |= o o.=o = .     |
│ |.=.o.*o.o .      |
│ |.oo.=ooB         |
│ |*+ ..=B..        |
│ +----[SHA256]-----+
│ Host xx.177.58.57 not found in /root/.ssh/known_hosts
│ /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_bastion.pub"
│ ssh: connect to host xx.177.58.57 port 22: No route to host

After I added the following lines to the vcd_vapp_vm bastion I could proceed without any problem.

  customization {
...omitted...
    admin_password = var.initialization_info["bastion_password"]
    enabled = true
    force = true
  }

So I would be happy if you can check if this is a local issue that I get or something more general as I explained.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant