Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save valentin2105/ccf68fb5a139f70e55492858492ea2d7 to your computer and use it in GitHub Desktop.
Save valentin2105/ccf68fb5a139f70e55492858492ea2d7 to your computer and use it in GitHub Desktop.
vbox-terraform
terraform {
required_providers {
virtualbox = {
source = "terra-farm/virtualbox"
version = "0.2.2-alpha.1"
}
}
}
provider "virtualbox" {}
resource "virtualbox_vm" "node" {
count = 2
name = format("node-%02d", count.index + 1)
image = "https://app.vagrantup.com/ubuntu/boxes/jammy64/versions/20220420.0.0/providers/virtualbox.box"
cpus = 2
memory = "1024 mib"
#user_data = file("${path.module}/user_data")
network_adapter {
type = "bridged"
host_interface = "enp0s31f6"
}
}
output "IPAddr" {
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 1)
}
output "IPAddr_2" {
value = element(virtualbox_vm.node.*.network_adapter.0.ipv4_address, 2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment