Created
April 24, 2025 03:59
-
-
Save valentin2105/ccf68fb5a139f70e55492858492ea2d7 to your computer and use it in GitHub Desktop.
vbox-terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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