Closed patsevanton closed 4 years ago
VBoxManage showvminfo node-01 --details
Name: node-01
Groups: /
Guest OS: Other Linux (64-bit)
UUID: a2eb6f0e-7856-46ba-966f-1b6aacd3c47d
Config file: /home/user/.terraform/virtualbox/machine/node-01/node-01.vbox
Snapshot folder: /home/user/.terraform/virtualbox/machine/node-01/Snapshots
Log folder: /home/user/.terraform/virtualbox/machine/node-01/Logs
Hardware UUID: a2eb6f0e-7856-46ba-966f-1b6aacd3c47d
Memory size: 512MB
Page Fusion: off
VRAM size: 20MB
CPU exec cap: 100%
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 2
PAE: on
Long Mode: on
Triple Fault Reset: off
APIC: on
X2APIC: off
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode: disabled
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
BIOS APIC mode: APIC
Time offset: 0ms
RTC: UTC
Hardw. virt.ext: on
Nested Paging: on
Large Pages: on
VT-x VPID: on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State: running (since 2019-08-26T07:14:48.882000000)
Monitor count: 1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
Storage Controller Name (0): SATA
Storage Controller Type (0): IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 30
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
SATA (0, 0): /home/user/.terraform/virtualbox/machine/node-01/centos-7-1-1.x86_64.vmdk (UUID: 67c6cb31-9e15-43bf-892b-33c40c087362)
NIC 1: MAC: 080027BF15AB, Attachment: Host-only Interface 'vboxnet1', Cable connected: on, Trace: off (file: none), Type: 82545EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
UART 3: disabled
UART 4: disabled
LPT 1: disabled
LPT 2: disabled
Audio: enabled (Driver: PulseAudio, Controller: AC97, Codec: STAC9700)
Audio playback: disabled
Audio capture: disabled
Clipboard Mode: disabled
Drag and drop Mode: disabled
Session name: headless
Video mode: 720x400x0 at 0,0 enabled
VRDE: disabled
USB: disabled
EHCI: disabled
XHCI: disabled
USB Device Filters:
<none>
Available remote USB devices:
<none>
Currently Attached USB Devices:
<none>
Bandwidth groups: <none>
Shared folders: <none>
VRDE Connection: not active
Clients so far: 0
Guest:
Configured memory balloon size: 0 MB
OS type: Linux_64
Additions run level: 0
Guest Facilities:
No active facilities.
VBoxManage list dhcpservers
NetworkName: HostInterfaceNetworking-vboxnet1
IP: 192.168.57.2
NetworkMask: 255.255.255.0
lowerIPAddress: 192.168.57.3
upperIPAddress: 192.168.57.254
Enabled: Yes
VBoxManage list hostonlyifs
Name: vboxnet1
GUID: 786f6276-656e-4174-8000-0a0027000001
DHCP: Disabled
IPAddress: 192.168.57.1
NetworkMask: 255.255.255.0
IPV6Address: fe80::800:27ff:fe00:1
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:01
MediumType: Ethernet
Wireless: No
Status: Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet1
If use https://vagrantcloud.com/bento/boxes/centos-7/versions/201907.24.0/providers/virtualbox.box
example.tf
resource "virtualbox_vm" "node" {
count = 1
name = format("node-%02d", count.index + 1)
image = "bento-centos-7.box"
cpus = 2
memory = "512 mib"
user_data = file("user_data")
network_adapter {
type = "hostonly"
host_interface = "vboxnet1"
}
}
output "IPAddr" {
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}
Log
2019-08-26T14:01:58.702+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5240-vbm.go:75: executing: VBoxManage showvminfo 5b1568f2-0392-45ab-837c-330d1c6d40e6 --machinereadable
2019-08-26T14:01:58.803+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5240-vbm.go:60: executing: VBoxManage getextradata node-01 user_data
2019-08-26T14:01:58.864+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5240-vbm.go:60: executing: VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/MAC
2019-08-26T14:01:58.929+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5240-vbm.go:60: executing: VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/Status
2019-08-26T14:01:58.997+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-5240-vbm.go:60: executing: VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/V4/IP
virtualbox_vm.node[0]: Creation complete after 40s [id=5b1568f2-0392-45ab-837c-330d1c6d40e6]
2019-08-26T14:01:59.066+0600 [DEBUG] plugin: plugin process exited: path=/home/user/.terraform.d/plugins/terraform-provider-virtualbox pid=5240
2019-08-26T14:01:59.066+0600 [DEBUG] plugin: plugin exited
2019/08/26 14:01:59 [TRACE] [walkApply] Exiting eval tree: provider.virtualbox (close)
2019/08/26 14:01:59 [TRACE] vertex "provider.virtualbox (close)": visit complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Outputs:
IPAddr = 192.168.57.3
Need use bento centos-7 box
Why cannot get /VirtualBox/GuestInfo/Net/0/MAC?
example.tf
wget https://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-1907_01.VirtualBox.box terraform apply
Output 2019-08-26T13:19:47.414+0600 [DEBUG] plugin.terraform-provider-virtualbox: pid-29909-vbm.go:60: executing: VBoxManage guestproperty get node-01 /VirtualBox/GuestInfo/Net/0/MAC
Full output https://gist.github.com/patsevanton/23f20ffe041719c2a3c2e5eca69b4b8e
Topic on forums.virtualbox.org https://forums.virtualbox.org/viewtopic.php?f=3&t=94455