Open patsevanton opened 5 years ago
node3
[root@node3 ~]# ip a
3: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:24:a1:5b brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s17
valid_lft 81822sec preferred_lft 81822sec
inet6 fe80::ffc3:fb7e:5052:c8bd/64 scope link noprefixroute
valid_lft forever preferred_lft forever
node2
[root@node2 ~]# ip a
3: enp0s17: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:95:b9:1b brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s17
valid_lft 81806sec preferred_lft 81806sec
inet6 fe80::9a82:5804:2bcf:571b/64 scope link noprefixroute
valid_lft forever preferred_lft forever
How Add NATNetwork interface?
@patsevanton we know there is still a lot missing. At the moment we only have a vm
resource. We should add quite a bit more datasource
s and resource
s to this provider to make everything much more workable and configurable.
How printf variable attr - https://github.com/patsevanton/terraform-provider-virtualbox/blob/master/virtualbox/resource_vm.go#L512 ?
change netTfToVbox func
func netTfToVbox(d *schema.ResourceData) ([]vbox.NIC, error) {
tfToVboxNetworkType := func(attr string) (vbox.NICNetwork, error) {
fmt.Println("WARNING: ------------------------ attr")
fmt.Println(attr)
switch attr {
case "bridged":
return vbox.NICNetBridged, nil
case "nat":
return vbox.NICNetNAT, nil
case "hostonly":
return vbox.NICNetHostonly, nil
case "internal":
return vbox.NICNetInternal, nil
case "generic":
return vbox.NICNetGeneric, nil
default:
mydata := []byte(netType)
err := ioutil.WriteFile("tfToVboxNetworkType.txt", mydata, 0777)
if err != nil {
fmt.Println(err)
}
return ""
}
}
But i dont find tfToVboxNetworkType.txt
Different between
case "hostonly":
return vbox.NICNetHostonly, nil
and
case "natnetwork":
return vbox.NICNetNatNetwork, nil
Output command:
--nic1 --nictype1 82545EM --cableconnected1 on
and
--nic1 hostonly --nictype1 82545EM --cableconnected1 on --hostonlyadapter1 vboxnet0
I created pull request https://github.com/terra-farm/go-virtualbox/pull/11
But error is same:
2019-08-27T22:22:52.506+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5351-vbm.go:45: executing: VBoxManage modifyvm ansible --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux_64 --cpus 1 --memory 256 --vram 20 --acpi on --ioapic on --rtcuseutc on --cpuhotplug off --pae on --longmode on --hpet off --hwvirtex on --triplefaultreset off --nestedpaging on --largepages on --vtxvpid on --vtxux on --accelerate3d off --boot1 disk --boot2 none --boot3 none --boot4 none --nic1 --nictype1 82545EM --cableconnected1 on
2019-08-27T22:22:52.573+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5351-utils.go:12: [ERROR] Setup VM properties: exit status 1
2019/08/27 22:22:52 [DEBUG] virtualbox_vm.ansible[0]: apply errored, but we're indicating that via the Error pointer rather than returning it: [ERROR] Setup VM properties: exit status 1
Hello!
@ringods can you check code https://github.com/isage/terraform-provider-virtualbox ? Thanks
Box https://vagrantcloud.com/geerlingguy/boxes/centos7/versions/1.2.16/providers/virtualbox.box
Terraform config
terraform show