68 lines
1.3 KiB
Terraform
68 lines
1.3 KiB
Terraform
|
terraform {
|
||
|
required_providers {
|
||
|
libvirt = {
|
||
|
source = "dmacvicar/libvirt"
|
||
|
version = "0.7.6"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
provider "libvirt" {
|
||
|
uri = "qemu:///system"
|
||
|
}
|
||
|
|
||
|
resource "libvirt_volume" "fcos" {
|
||
|
name = "fcos"
|
||
|
pool = "default"
|
||
|
source = "fedora-coreos-39.20240128.3.0-qemu.x86_64.qcow2"
|
||
|
format = "qcow2"
|
||
|
}
|
||
|
resource "libvirt_volume" "kanidm" {
|
||
|
name = "kanidm-rootfs.qcow2"
|
||
|
base_volume_id = libvirt_volume.fcos.id
|
||
|
}
|
||
|
|
||
|
resource "libvirt_volume" "data" {
|
||
|
name = "kanidm-data.qcow2"
|
||
|
pool = "default"
|
||
|
size = 3221225472
|
||
|
format = "qcow2"
|
||
|
lifecycle {
|
||
|
prevent_destroy = true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "libvirt_ignition" "kanidm" {
|
||
|
name = "kanidm-service.ign"
|
||
|
content = "service.ign"
|
||
|
}
|
||
|
|
||
|
resource "libvirt_domain" "kanidm" {
|
||
|
name = "kanidm"
|
||
|
autostart = true
|
||
|
memory = "2048"
|
||
|
vcpu = 2
|
||
|
|
||
|
coreos_ignition = libvirt_ignition.kanidm.id
|
||
|
|
||
|
disk {
|
||
|
volume_id = "${libvirt_volume.kanidm.id}"
|
||
|
}
|
||
|
disk {
|
||
|
volume_id = "${libvirt_volume.data.id}"
|
||
|
}
|
||
|
network_interface {
|
||
|
network_name = "default"
|
||
|
hostname = "kanidm.hklbgd.org"
|
||
|
addresses = ["192.168.122.110"]
|
||
|
mac = "56:FA:7E:C9:6A:E9"
|
||
|
wait_for_lease = true
|
||
|
}
|
||
|
console {
|
||
|
type = "pty"
|
||
|
target_port = "0"
|
||
|
target_type = "virtio"
|
||
|
source_path = "/dev/pts/25"
|
||
|
}
|
||
|
}
|