summaryrefslogtreecommitdiff
path: root/examples/count/libvirt.tf
blob: de6ca59bcc7239fbdb227e4f59fe9b9bc33f076b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
provider "libvirt" {
  uri = "qemu:///system"
}

resource "libvirt_volume" "opensuse_leap" {
  name = "opensuse_leap"
  source = "http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2"
}

resource "libvirt_volume" "volume" {
  name = "volume-${count.index}"
  base_volume_id = "${libvirt_volume.opensuse_leap.id}"
  count = 4
}

resource "libvirt_domain" "domain" {
  name = "domain-${count.index}"
  disk {
       volume_id = "${element(libvirt_volume.volume.*.id, count.index)}"
  }
  count = 4
}