Установка провайдера VirtualBox для terraform

Перед установкой провайдера VirtualBox необходимо установить компилятор языка Go, как описано по ссылке.

Установка производится следующей командой:

$ go get github.com/terra-farm/terraform-provider-virtualbox

Пример конфигурации:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
resource "virtualbox_vm" "node" {
    count = 2
    name = "${format("node-%02d", count.index+1)}"

    image = "~/ubuntu-15.04.tar.xz"
    cpus = 2
    memory = "512mib"

    network_adapter {
        type = "nat"
    }

    network_adapter {
        type = "bridged"
        host_interface = "en0"
    }

    optical_disks = ["./cloudinit.iso"]
}

output "IPAddr" {
    # Get the IPv4 address of the bridged adapter (the 2nd one) on 'node-02'
    value = "${element(virtualbox_vm.node.*.network_adapter.1.ipv4_address, 1)}"
}

Примечание

Полезные ссылки: https://github.com/terra-farm/terraform-provider-virtualbox

Documentation Status