Hey, new to forum.
BLUF: How can I create a VM from ISO file using terraform? Things seem to have changed--I have tried what I found online and keep running into issues.
Xen Orchestra latest commit cb6cf
XCP-ng 8.2.1 (GPLv2)
vatesfr/xenorchestra v0.29.0
Want to use terraform to create a VyOS router in XCP-ng. I have done before manually. I would like to create the VM for the VyOS router from the ISO with the correct interfaces.
It looks like I can't use the template "Other install media" and supply a cdrom{}. When I try, the iso file is not found.
In the future, I would like to use cloud-init to spin up the VyOS router. Until then, I'm looking to spin up with terraform and configure using Ansible.
Here is the full code.
https://github.com/doritoes/NUC-Labs/tree/xcp-ng-improvement/XCP-ng/terraform
The full XCP-ng build steps I used are documented there too.
data "xenorchestra_network" "wan" {
name_label = "Pool-wide network associated with eth0"
}
data "xenorchestra_network" "build" {
name_label = "build"
depends_on = [xenorchestra_network.vlan_network_100]
}
data "xenorchestra_template" "template" {
name_label = "Other install media"
}
data "xenorchestra_sr" "local" {
name_label = "Local storage"
}
data "xenorchestra_sr" "ISO" {
name_label = "ISO"
}
data "xenorchestra_vdi" "vyos_rolling" {
name_label = "vyos-1.5-rolling-202407010024-amd64.iso"
}
resource "xenorchestra_vm" "vyos" {
memory_max = 1073733632
cpus = 2
#cloud_config =
name_label = "vyos"
name_description = "vyos router"
template = data.xenorchestra_template.template.id
cdrom {
id = data.xenorchestra_vdi.vyos_rolling.id
}
disk {
sr_id = data.xenorchestra_sr.local.id
name_label = "vyos-router-disk"
size = 8589869056
}
network {
network_id = data.xenorchestra_network.wan.id
}
network {
network_id = data.xenorchestra_network.build.id
}
}