Compare commits
3 Commits
17a810d9c0
...
41302119a7
Author | SHA1 | Date | |
---|---|---|---|
|
41302119a7 | ||
|
d0dc1f02f6 | ||
|
1f1f2ce12f |
27
multiple/environments/phyllome-42-uefi/main.tf
Normal file
27
multiple/environments/phyllome-42-uefi/main.tf
Normal file
@@ -0,0 +1,27 @@
|
||||
terraform {
|
||||
required_version = ">= 0.13"
|
||||
required_providers {
|
||||
libvirt = {
|
||||
source = "dmacvicar/libvirt"
|
||||
version = "0.8.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "libvirt" {
|
||||
uri = "qemu:///system"
|
||||
}
|
||||
|
||||
module "shared_modules" {
|
||||
source = "../../shared_modules"
|
||||
|
||||
vm_name = "phyllome-42-uefi"
|
||||
image_location = "/var/lib/libvirt/images/virtual-desktop-hypervisor.img"
|
||||
enable_cloudinit = false
|
||||
# ---- OPTIONAL UEFI SETTINGS ----------------------------------------------
|
||||
uefi_firmware = "/usr/share/edk2/x64/OVMF_CODE.4m.fd"
|
||||
uefi_nvram_template = "/usr/share/edk2/x64/OVMF_VARS.4m.fd"
|
||||
uefi_nvram_file_suffix = "-uefi"
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
}
|
@@ -3,6 +3,17 @@ resource "libvirt_domain" "domain" {
|
||||
name = "${var.vm_name}-${count.index}"
|
||||
memory = var.memory
|
||||
vcpu = var.vcpu
|
||||
machine = "q35"
|
||||
|
||||
# The chipset q35, which does not support the IDE bus, does not work with the terraform-provider-libvirt cloud-init implementation,
|
||||
# which creates an ISO attached to an IDE bus by default. Workaround is implemented
|
||||
# https://github.com/dmacvicar/terraform-provider-libvirt/issues/1137#issuecomment-2592329846
|
||||
# A cleaner solution might be the following :
|
||||
# https://github.com/dmacvicar/terraform-provider-libvirt/pull/895#issuecomment-1911167872
|
||||
|
||||
xml {
|
||||
xslt = file("${path.module}/q35-workaround.xslt")
|
||||
}
|
||||
|
||||
# Only include cloudinit if enabled
|
||||
cloudinit = var.enable_cloudinit ? libvirt_cloudinit_disk.commoninit[count.index].id : null
|
||||
|
16
multiple/shared_modules/q35-workaround.xslt
Normal file
16
multiple/shared_modules/q35-workaround.xslt
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" ?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output omit-xml-declaration="yes" indent="yes"/>
|
||||
<xsl:template match="node()|@*">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()|@*"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<xsl:template match="/domain/devices/disk[@device='cdrom']/target/@bus">
|
||||
<xsl:attribute name="bus">
|
||||
<xsl:value-of select="'sata'"/>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/domain/devices/disk[@device='cdrom']/alias" />
|
||||
</xsl:stylesheet>
|
@@ -49,6 +49,7 @@ variable "enable_cloudinit" {
|
||||
variable "ssh_key" {
|
||||
description = "SSH authorized keys for cloud-init"
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "user_data" {
|
||||
@@ -70,7 +71,7 @@ variable "memory" {
|
||||
variable "vcpu" {
|
||||
description = "Number of virtual CPUs"
|
||||
type = number
|
||||
default = 1
|
||||
default = 2
|
||||
}
|
||||
|
||||
variable "network_mode" {
|
||||
|
Reference in New Issue
Block a user