Skip to content

Commit

Permalink
libvirt: add support for dnsmasq options in the terraform files
Browse files Browse the repository at this point in the history
This adds the dnsmasq options block and the corresponding datasource to the libvirt terraform files
  • Loading branch information
Prashanth684 committed Jan 4, 2021
1 parent deefdfd commit 793bf16
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions data/data/libvirt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ resource "libvirt_network" "net" {
}
}

dnsmasq_options {
dynamic "options" {
for_each = concat(
data.libvirt_network_dnsmasq_options_template.options.*.rendered,
)
content {
option_name = options.value.option_name
option_value = options.value.option_value
}
}
}


autostart = true
}

Expand Down Expand Up @@ -127,3 +140,9 @@ data "libvirt_network_dns_host_template" "masters_int" {
hostname = "api-int.${var.cluster_domain}"
}

data "libvirt_network_dnsmasq_options_template" "options" {
count = length(var.libvirt_dnsmasq_options)
option_name = keys(var.libvirt_dnsmasq_options)[count.index]
option_value = values(var.libvirt_dnsmasq_options)[count.index]
}

6 changes: 6 additions & 0 deletions data/data/libvirt/variables-libvirt.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ variable "libvirt_master_size" {
description = "Size of the volume in bytes"
default = "17179869184"
}

variable "libvirt_dnsmasq_options" {
type = map(string)
description = "Dnsmasq options to be applied to the libvirt network"
default = {}
}

0 comments on commit 793bf16

Please sign in to comment.