main.tf 904 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. resource "libvirt_volume" "bootstrap" {
  2. name = "${var.cluster_name}-bootstrap"
  3. base_volume_id = "${var.base_volume_id}"
  4. }
  5. data "template_file" "user_data" {
  6. template = "${file("${path.module}/user-data.tpl")}"
  7. vars {
  8. ssh_authorized_keys = "${var.ssh_key}"
  9. }
  10. }
  11. resource "libvirt_cloudinit_disk" "bootstrapinit" {
  12. name = "${var.cluster_name}-bs-init.iso"
  13. user_data = "${data.template_file.user_data.rendered}"
  14. }
  15. resource "libvirt_domain" "bootstrap" {
  16. name = "${var.cluster_name}-bootstrap"
  17. memory = "2048"
  18. vcpu = "2"
  19. cloudinit = "${libvirt_cloudinit_disk.bootstrapinit.id}"
  20. disk {
  21. volume_id = "${libvirt_volume.bootstrap.id}"
  22. }
  23. console {
  24. type = "pty"
  25. target_port = 0
  26. }
  27. network_interface {
  28. network_id = "${var.network_id}"
  29. hostname = "${var.cluster_name}-bootstrap"
  30. addresses = "${var.addresses}"
  31. }
  32. }