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" "forgejo_rootfs" {
|
||
|
name = "forgejo_rootfs"
|
||
|
base_volume_id = libvirt_volume.fcos.id
|
||
|
}
|
||
|
|
||
|
resource "libvirt_volume" "data" {
|
||
|
name = "data.qcow2"
|
||
|
pool = "default"
|
||
|
size = 354334801920
|
||
|
format = "qcow2"
|
||
|
lifecycle {
|
||
|
prevent_destroy = true
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "libvirt_ignition" "ign" {
|
||
|
name = "service.ign"
|
||
|
content = "service.ign"
|
||
|
}
|
||
|
|
||
|
resource "libvirt_domain" "default" {
|
||
|
name = "forgejo"
|
||
|
autostart = true
|
||
|
memory = "2048"
|
||
|
vcpu = 2
|
||
|
|
||
|
coreos_ignition = libvirt_ignition.ign.id
|
||
|
|
||
|
disk {
|
||
|
volume_id = "${libvirt_volume.forgejo_rootfs.id}"
|
||
|
}
|
||
|
disk {
|
||
|
volume_id = "${libvirt_volume.data.id}"
|
||
|
}
|
||
|
network_interface {
|
||
|
network_name = "default"
|
||
|
hostname = "forgejo"
|
||
|
addresses = ["192.168.122.150"]
|
||
|
mac = "A6:3A:5E:C4:5A:C3"
|
||
|
wait_for_lease = true
|
||
|
}
|
||
|
console {
|
||
|
type = "pty"
|
||
|
target_port = "0"
|
||
|
target_type = "virtio"
|
||
|
source_path = "/dev/pts/24"
|
||
|
}
|
||
|
}
|