Open The-Loeki opened 2 years ago
Workaround XSLT:
resource libvirt_network network {
name = "net-${var.name}"
dnsmasq_options {
dynamic options {
for_each = {
conf-file = "/usr/share/dnsmasq/trust-anchors.conf"
dns-forward-max = 1024
}
content {
option_name = options.key
option_value = options.value
}
}
}
# Workaround for https://github.com/dmacvicar/terraform-provider-libvirt/issues/914
xml {
xslt = templatefile("${path.module}/tpl/dnsmasq.xsl", {options=["dnssec", "dnssec-check-unsigned"]})
}
}
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0">
<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="/network/dnsmasq:options">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
%{ for option in options ~}
<xsl:element name="dnsmasq:option">
<xsl:attribute name="value">${option}</xsl:attribute>
</xsl:element>
%{ endfor ~}
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Stumbled into this too trying to pass bind-interfaces
option
Lots of DNSmasq options come as keywords only, but
dnsmasq_options
currently rendersoption_name=option_value
.Renders
which dnsmasq doesnt like
But = is hardcoded in: https://github.com/dmacvicar/terraform-provider-libvirt/blob/06d383abe97b94603edb6fd68f318ad1b3ad4685/libvirt/network.go#L192