terra-farm/terraform-provider-virtualbox

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

git006 opened this issue · 9 comments

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

resource "virtualbox_vm" "node" {
count = 1
name = "${format("k8s-%02d", count.index+1)}"
url = "https://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-2004_01.VirtualBox.box"
image = "./VirtualBox.box"
cpus = 1
memory = "512 Mib"
network_adapter {
type = "bridged"
host_interface = "wlp0s20f3"
# device = "wlp0s20f3"
}
}

I installed virtualbox in my ubuntu. What value should i provide to the host_interface or device? i just check ifconfig and got the adapter name "wlp0s20f3".

after terraform apply, it said "Error: [ERROR] can't convert vbox network to terraform data: No match with get guestproperty output".

same here, I think the VM it's still starting after 60 seconds, there is a PR that put a timeout as a variable, so we could tweak it easily.

Hello, quick msg to give a full explanation of how to successfully use the provider, testd with ubuntu and debian, with full explanations and details about the caveats and limitations of the provider: https://github.com/3forges/packman/tree/0.0.2/terraform
also might be appreciated https://github.com/3forges/packman/tree/0.0.2/packer

@Jean-Baptiste-Lasselle I add PR (terra-farm/go-virtualbox#45) for fix bridge-adapter.

@git006 VirtualBox gold image need contain VBox GuestAdditons (https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html)

For more detail see
VBoxManage guestproperty enumerate "vm-name"

@Jean-Baptiste-Lasselle I add PR (terra-farm/go-virtualbox#45) for fix bridge-adapter.

@git006 VirtualBox gold image need contain VBox GuestAdditons (https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html)

For more detail see VBoxManage guestproperty enumerate "vm-name"

:) Oh, someone read my long analysis :) (Ctrl + F where the option syntax is now --bridge-adapter<1-N>, and not --bridgeadapter<1-N> anymore. I hereafter, checked that it still in that analysis of mine) ... I see, and thank you for pinging me I'm happy this could help, I could have done the PR, but I have other plans actually, to bring up a different design for terraforming virutalbox VMs, which is why I was interested in the study :) ... And As I have explained it, the virtualbox provider from terra-farm still works even if it will break soon. But it's true a PR will make the provider last longer.

All in all, it still is a good surprise, that there still exists this one out of ten thousand, who would read a very long, in-depth analysis :) ... And thank you for the mention :)

Oh, and btw, one question @CyraxNova : Do you mean that the can't convert vbox network to terraform data: error message, is caused by the fact that the device configration option, is mean to set a guest property of the VirtualBox VM, provided that the VirtualBox Guest Additions is already there in the "golden" VM image ?

@Jean-Baptiste-Lasselle : Yes. I'm using image = "https://app.vagrantup.com/ubuntu/boxes/jammy64/versions/20240315.1.0/providers/virtualbox.box" (Ubuntu 22.04). By default, the image does not contain VirtualBox GuestAdditons. Need to install VirtualBox GuestAdditons on the vm and repackage the image. Not VM VirtualBox Extension Pack. Exactly VBox GuestAdditons.

@Jean-Baptiste-Lasselle : Yes. I'm using image = "https://app.vagrantup.com/ubuntu/boxes/jammy64/versions/20240315.1.0/providers/virtualbox.box" (Ubuntu 22.04). By default, the image does not contain VirtualBox GuestAdditons. Need to install VirtualBox GuestAdditons on the vm and repackage the image. Not VM VirtualBox Extension Pack. Exactly VBox GuestAdditons.

Ahhhh Thank you so very much, I will test that as soon as possible: I like it very much when every single detail is completely analyzed, and in my case, i made the terraform provider work, without the can't convert vbox network to terraform data: error message anymore, simply because I commented the device configuration option. So I will add to my study this detail, appreciate very much your indication, which i will definitely test and add to my study :) . The final point I want to add there is answering this question: If I set the device configuration option, what happens in my VM ? What is it useful for ? To set the name of the Linux network interface ? to do what exactly ? Or said otherwise, Why would I want to set the device guest property for my VirtualBox VM?

For the sake of the reader, I add that the PR created by my fellow colleague @CyraxNova is a bout a completely unrelated and independent matter : and our discussion here makes it clear

@Jean-Baptiste-Lasselle VBox GuestAdditons need for work all func in https://github.com/terra-farm/go-virtualbox/blob/main/guestprop.go .You can see the error No match with get guestproperty output in https://github.com/terra-farm/go-virtualbox/blob/main/guestprop.go#L49

see https://www.virtualbox.org/manual/UserManual.html#guestadd-guestprops
"Oracle VM VirtualBox enables requests of some properties from a running guest, provided that the Oracle VM VirtualBox Guest Additions are installed and the VM is running. "

@Jean-Baptiste-Lasselle VBox GuestAdditons need for work all func in https://github.com/terra-farm/go-virtualbox/blob/main/guestprop.go .You can see the error No match with get guestproperty output in https://github.com/terra-farm/go-virtualbox/blob/main/guestprop.go#L49

see https://www.virtualbox.org/manual/UserManual.html#guestadd-guestprops "Oracle VM VirtualBox enables requests of some properties from a running guest, provided that the Oracle VM VirtualBox Guest Additions are installed and the VM is running. "

Sure, sure, now the end question I will investigate is : Ok, we know how to set a guest property, programmatically, but why would we want to do that ? :) (would it help seting for example, the name of the Linux net interface in the VM at provisioning time, like setting it to eth0 or enp0s3 ?) I never used guest properties in the past, and what does it mean/stands for, device ?