49 lines
No EOL
942 B
HCL
49 lines
No EOL
942 B
HCL
terraform {
|
|
required_providers {
|
|
libvirt = {
|
|
source = "dmacvicar/libvirt"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "libvirt" {
|
|
uri = "qemu:///system"
|
|
}
|
|
|
|
resource "libvirt_volume" "win11-ltsc-cloudbase-init" {
|
|
name = "win11-ltsc-cloudbase-init.qcow2"
|
|
pool = "default" # List storage pools using virsh pool-list
|
|
source = "win11-ltsc-original.qcow2"
|
|
format = "qcow2"
|
|
}
|
|
|
|
resource "libvirt_domain" "win11-ltsc-cloudbase-init" {
|
|
name = "win11-ltsc-cloudbase-init"
|
|
memory = "8192"
|
|
vcpu = 4
|
|
|
|
network_interface {
|
|
network_name = "default" # List networks with virsh net-list
|
|
}
|
|
|
|
disk {
|
|
volume_id = "${libvirt_volume.win11-ltsc-cloudbase-init.id}"
|
|
}
|
|
|
|
console {
|
|
type = "pty"
|
|
target_type = "serial"
|
|
target_port = "0"
|
|
}
|
|
|
|
graphics {
|
|
type = "spice"
|
|
listen_type = "address"
|
|
autoport = true
|
|
}
|
|
}
|
|
|
|
# Output Server IP
|
|
output "ip" {
|
|
value = "${libvirt_domain.centos7.network_interface.0.addresses.0}"
|
|
} |