terra-farm / terraform-provider-virtualbox

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

Second network card don`t assign IP address #72

Open patsevanton opened 4 years ago

patsevanton commented 4 years ago

main.tf

resource "virtualbox_vm" "node" {
  count     = 1
  name      = format("node-%02d", count.index + 1)
  image     = "bento-centos-7.box"
  cpus      = 1
  memory    = "512 mib"

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

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

Get comand virtualbox from log:

VBoxManage list vms
VBoxManage createvm --name node-01 --register --basefolder /home/user/.terraform/virtualbox/machine
VBoxManage showvminfo node-01 --machinereadable
VBoxManage clonehd /home/user/.terraform/virtualbox/gold/bento-centos-7/centos-7.6-x86_64-disk001.vmdk /home/user/.terraform/virtualbox/machine/node-01/centos-7.6-x86_64-disk001.vmdk
VBoxManage storagectl node-01 --name SATA --add sata --portcount 2 --controller IntelAHCI --hostiocache on --bootable on
VBoxManage storageattach node-01 --storagectl SATA --port 0 --device 0 --type hdd --medium /home/user/.terraform/virtualbox/machine/node-01/centos-7.6-x86_64-disk001.vmdk
VBoxManage modifyvm node-01 --firmware bios --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 0 --biosbootmenu disabled --ostype Linux_64 --cpus 1 --memory 512 --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 hostonly --nictype1 82545EM --cableconnected1 on --hostonlyadapter1 vboxnet0 --nic2 hostonly --nictype2 82545EM --cableconnected2 on --hostonlyadapter2 vboxnet1
VBoxManage showvminfo node-01 --machinereadable
VBoxManage startvm node-01 --type headless
VBoxManage showvminfo 769bbafb-9cd9-4957-9cca-e58a00ee6a9c --machinereadable
VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/MAC
VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/Status
VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/V4/IP
VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/1/MAC

Don`t have ifcfg-eth1

patsevanton commented 4 years ago

Work with https://vagrantcloud.com/geerlingguy/boxes/centos7/versions/1.2.16/providers/virtualbox.box