about summary refs log tree commit diff
path: root/terraform/plan9-cluster.hcl
blob: 93b9eec0ad04c6be8a3bc8c5e8ccde2bec321571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
provider "libvirt" {
  uri = "qemu:///system"
}

resource "libvirt_volume" "plan9_image" {
  name   = "plan9-image"
  pool   = "default"
  source = "/path/to/plan9.iso"
  format = "raw"
}

resource "libvirt_network" "plan9_network" {
  name = "plan9-network"
  mode = "nat"
  addresses = ["192.168.123.0/24"]
}

resource "libvirt_domain" "plan9_node" {
  count  = 3
  name   = "plan9-node-${count.index + 1}"
  memory = "512"
  vcpu   = 1

  network_interface {
    network_name = libvirt_network.plan9_network.name
  }

  disk {
    volume_id = libvirt_volume.plan9_image.id
  }

  console {
    type        = "pty"
    target_type = "serial"
    target_port = "0"
  }

  graphics {
    type        = "vnc"
    listen_type = "address"
    listen_address = "127.0.0.1"
  }

  # Cloud-init is not applicable for Plan 9; manual configuration will be required
}

output "plan9_node_ips" {
  value = {
    for i in libvirt_domain.plan9_node: i.name => i.network_interface[0].addresses[0]
  }
}