Infrastructure as Code for creating Windows Server 2022 VMs using Terraform and libvirt on Ubuntu.
This project provisions Windows Server VMs for a lab environment featuring:
- Active Directory Domain Controller
- SQL Server Failover Cluster (3+ nodes)
- SQL Server Availability Groups
- Ubuntu Linux with KVM/libvirt installed
- Terraform installed
- libvirt provider v0.9.1+
- Windows Server 2022 base image (sysprepped)
- Prepare your base Windows Server 2022 qcow2 image
- Update paths in
main.tfto point to your base image - Run:
terraform init terraform plan terraform apply
- VM Name: sqlhost01
- Memory: 4096 MiB
- vCPU: 2
- Disk: SATA (Windows-compatible)
- Network: Default libvirt network
- Graphics: VNC
See SETUP_GUIDE.md for:
- Complete troubleshooting steps
- Lessons learned
- Best practices for creating additional VMs
- Known issues and workarounds
main.tf- Main Terraform configurationvm-template.tf.example- Template for creating additional VMsSETUP_GUIDE.md- Comprehensive setup and troubleshooting guide
See vm-template.tf.example for a ready-to-use template.
Personal lab project