terra-farm / terraform-provider-virtualbox

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

How do you access user_data inside instance? #89

Closed dcode closed 2 years ago

dcode commented 4 years ago

In your example, you show passing a JSON document into the instance:

https://github.com/terra-farm/terraform-provider-virtualbox/blob/e64dd8d729d93e2ea2df87460d7fbc35b7e451e3/examples/example.tf#L7

I've looked into cloud-init and ignition, and neither have support for a virtualbox specific interface. Ignition does have an open issue [1] considering using DMI data which can be set using specific virtualbox "extradata" keys.

My specific goal is to be able to locally test projects using terraform + ignition. This provider seems to be the closest option for now since the VIX provider is quite old now.

[1] https://github.com/coreos/ignition/issues/629

VoyTechnology commented 4 years ago

I’ve also noticed this. I’ve been looking for solutions and it seems the only way to do so is by creating an iso file with the config and mounting it. Right now it is being set as extra data in virtual box only, and it doesn’t seem to work.

Kraktorist commented 2 years ago

Looks like it can be implemented using sharedfolder functionality.

VBoxManage sharedfolder add VM_NAME --name user_data --transient -hostpath /path/VM_NAME_user_data -automount
VoyTechnology commented 2 years ago

Closing in favour of #150. But will keep the proposed solution in mind.