Skip to content

Commit

Permalink
fix for uefi
Browse files Browse the repository at this point in the history
  • Loading branch information
kubealex committed Jul 4, 2024
1 parent 3030976 commit af10a59
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
13 changes: 12 additions & 1 deletion terraform/bastion/bastion.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ resource "libvirt_domain" "bastion" {
vcpu = var.cpu
machine = "q35"
firmware = "/usr/share/edk2/ovmf/OVMF_CODE.fd"

disk {
volume_id = libvirt_volume.os_image.id
}
Expand All @@ -99,6 +99,17 @@ resource "libvirt_domain" "bastion" {
listen_type = "address"
autoport = "true"
}

# necessary when using UEFI
lifecycle {
ignore_changes = [
nvram
]
}

xml {
xslt = file("${path.module}/uefi-patch.xsl")
}
}

terraform {
Expand Down
20 changes: 20 additions & 0 deletions terraform/bastion/uefi-patch.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>

<!-- Identity transform to copy everything as is -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<!-- Use SATA CD-ROM for Linux setup for UEFI compatibility -->
<xsl:template match="disk[target/@bus='ide']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<target dev="sdb" bus="sata"/>
<xsl:apply-templates select="node()[not(self::target)]"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
11 changes: 11 additions & 0 deletions terraform/loadbalancer/loadbalancer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ resource "libvirt_domain" "infra-machine" {
listen_type = "address"
autoport = "true"
}

# necessary when using UEFI
lifecycle {
ignore_changes = [
nvram
]
}

xml {
xslt = file("${path.module}/uefi-patch.xsl")
}
}

terraform {
Expand Down
20 changes: 20 additions & 0 deletions terraform/loadbalancer/uefi-patch.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>

<!-- Identity transform to copy everything as is -->
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<!-- Use SATA CD-ROM for Linux setup for UEFI compatibility -->
<xsl:template match="disk[target/@bus='ide']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<target dev="sdb" bus="sata"/>
<xsl:apply-templates select="node()[not(self::target)]"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

0 comments on commit af10a59

Please sign in to comment.