terra-farm / terraform-provider-virtualbox

VirtualBox provider for Terraform
https://terra-farm.github.io/provider-virtualbox/
MIT License
323 stars 136 forks source link

If nat + host network cards defined, it will timeout #122

Open habhabhabs opened 2 years ago

habhabhabs commented 2 years ago

Hi, appreciate everyone's effort in maintaining this provider.

I've the following code block which the nodes need to connect to the internet via the nat gateway:

resource "virtualbox_vm" "node" {
  count     = 2
  name      = format("node-%02d", count.index + 1)
  image     = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20180903.0.0/providers/virtualbox.box"
  cpus      = 2
  memory    = "512 mib"
  user_data = file("${path.module}/user_data")

  network_adapter {
    type           = "nat"
  }

  network_adapter {
    type           = "hostonly"
    host_interface = "vboxnet3"
  }

}

Everything is deployed fine, but it does not receive the callback from VirtualBox that the VMs are created.

│ Error: [ERROR] Wait VM until ready: waiting for VM (tf-dbserver) to become ready: [ERROR] can't convert vbox network to terraform data: No match with get guestproperty output
│                                                                                                                                                        
│   with virtualbox_vm.node[2],                                             
│   on main.tf line 12, in resource "virtualbox_vm" "node":                                                                                              
│   12: resource "virtualbox_vm" "node" {                                                                                                                
│                                                      

It works fine if only host-only adapters are mentioned (in the terraform example). Thanks

nemonik commented 2 years ago

This issue appears to remain unresolved.

If you have a nat defined network_adapter

Error: [ERROR] Wait VM until ready: waiting for VM (mytest) to become ready: [ERROR] can't convert vbox network to terraform data: No match with get guestproperty output

  on main.tf line 14, in resource "virtualbox_vm" "node":
  14: resource "virtualbox_vm" "node" {
h3ct0rjs commented 2 years ago

Yes I can confirm this. After testing this provider I'm not so sure if this is the best way to play with terraform locally, it seems like the best option will be using other provider for docker or something like that but this provider needs more love ❤️

VoyTechnology commented 2 years ago

Added syntax hightlighting to the terraform configuration in the original comment.