terra-farm/terraform-provider-virtualbox

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

mohang6770 opened this issue ยท 15 comments

Terraform Version

<MISSING>

Virtualbox Provider version

<MISSING>

Operating System

<MISSING>

Describe the Bug

<MISSING>

To Reproduce

Steps to reproduce the behavior:

  1. <MISSING>

Expected Behaviour

<MISSING>

Configuration

terraform {
  required_providers {
    virtualbox = {
      source = "terra-farm/virtualbox"
      version = "0.2.2-alpha.1"
    }
  }
}

resource "virtualbox_vm" "node" {
  count     = 1
  name      = format("node-%02d", count.index + 1)
  image     = "https://app.vagrantup.com/ubuntu/boxes/bionic64/versions/20210916.0.0/providers/virtualbox.box"
  cpus      = 1
  memory    = "1024 mib"
  user_data = file("${path.module}/user_data.sh")
  
  network_adapter {
    type           = "nat"
  }
  network_adapter {
    type           = "bridged"
    host_interface = "eno1"
  }

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

output "IPAddr" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}

output "IPAddr_2" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
}

Log Output

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

snap.

Hi @mohang6770, thank you for submitting this issue. I took some liberty in applying the latest issue template to this bug report, I hope you don't mind. Can you please provide some of the missing fields? Thank you.

I think the issues #138 and #134 report the same problem. Maybe a maintainer could close them as duplicates. I have the same issue using the following configuration:

Terraform version

v1.2.2

Virtualbox provider version

v0.2.2-alpha.1

Operating system

Debian 11

Describe the bug

This is my terraform configuration I'm trying to apply.

terraform {
  required_providers {
    virtualbox = {
      source = "terra-farm/virtualbox"
      version = "0.2.2-alpha.1"
    }
  }
}

# There are currently no configuration options for the provider itself.

resource "virtualbox_vm" "node" {
  count     = 2
  name      = format("node-%02d", count.index + 1)
  image     = "virtualbox_windows-10.box"
  network_adapter {
    type           = "hostonly"
    host_interface = "vboxnet0"
  }
}

output "IPAddr" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}

output "IPAddr_2" {
  value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
}

When I apply the configuration file two virtual machines are created and one of them is running, the other is powered off. Then I run into the following error message:

โ•ท
โ”‚ Error: [ERROR] Wait VM until ready: waiting for VM (node-02) to become ready: [ERROR] can't convert vbox network to terraform data: No match with get guestproperty output
โ”‚
โ”‚   with virtualbox_vm.node[1],
โ”‚   on main.tf line 12, in resource "virtualbox_vm" "node":
โ”‚   12: resource "virtualbox_vm" "node" {
โ”‚
โ•ต
โ•ท
โ”‚ Error: [ERROR] Clone *.vdi and *.vmdk to VM folder: exit status 1
โ”‚
โ”‚   with virtualbox_vm.node[0],
โ”‚   on main.tf line 12, in resource "virtualbox_vm" "node":
โ”‚   12: resource "virtualbox_vm" "node" {
โ”‚
โ•ต

To Reproduce

Just use the provided terraform file with a windows box.

Expected behaviour

I would just expect the build to finish. The network used in the configuration exists.

I think I found the bug in the terra-form/go-virtualbox repository and have created a pull request for it. You can find further details on the bug in the PR.

Hey @nikstuckenbrock, now that your change is merged, do you want to create another PR to this repository to bump the go-virtualbox dependency version?

Hey @VoyTechnology, thanks for reaching out. I've provided a new PR #155 to bump the version.

Merged. Can you validate that the problem has been fixed? If so, I will tag a new release.

Hey @VoyTechnology , build proceeds now and resolves in another error. So reading out the guestproperty works now. You could flag a new release or wait until I have investigated the new error message if you want.

Update: It seems like it's not really an error. The time waiting for the VM to become available is set to 30 seconds which seems to be to short for my use case. I would be a nice feature though.

Hey @mohang6770 ,
a little bit more communication would be helpful. It looks like you're not using the source version, instead you use the same version as before? Furthermore you're reporting a completely different error message than before. Could you provide more details?

Hi there,

I am still struggling to get this to work, and I am still getting the same error as previously described:

can't convert vbox network to terraform data: No match with get guestproperty output

Hey @EduardoSantanaSeverino,

it would be very nice if you could provide all the information mentioned in the bug report template. Have you tried debugging the provider (after compiling it yourself) as mentioned in the docs? Moreover I would suggest to check your version again. The latest released version does not contain the fix provided in #156, you'll need to use the explicit commit hash to get the latest code. I hope this helps you to analyse/fix your problem,

Today I got this error. In my case, the problem was that the vm doesn't have enough memory to start Ubuntu.

I got this error also. I only saw it when I tried to increase the count from 1 to 2. The VM was able to boot up just fine, but the error showed up before it could finish booting up. I think it was a timeout issue for me.

I instead made each resource boot up with a "depends_on" parameter to the previous resource. It's a workaround for me.