Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save valentin2105/ccf68fb5a139f70e55492858492ea2d7 to your computer and use it in GitHub Desktop.

Select an option

Save valentin2105/ccf68fb5a139f70e55492858492ea2d7 to your computer and use it in GitHub Desktop.

Revisions

  1. Valentin Ouvrard created this gist Apr 24, 2025.
    33 changes: 33 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    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)
    }