Skip to content

Commit

Permalink
Fix boolean assignments in templates
Browse files Browse the repository at this point in the history
By the rules [1] booleans should be represented by the unquoted symbols true and
false. This commit ensures the non quotation and the lowercase for every
assignment.

[1] https://developer.hashicorp.com/terraform/language/expressions/types#bool
  • Loading branch information
rascasoft committed Mar 25, 2024
1 parent 63fd5d2 commit d0fce7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions templates/libvirt/networks.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
resource "libvirt_network" "{{ network.name }}" {
name = "{{ network.name }}"
mode = "{{ network.mode }}"
autostart = "{{ network.autostart | default('true') }}"
autostart = {{ network.autostart | default('true') | lower() }}
{% if network.domain is defined %}
domain = "{{ network.domain }}"
{% endif %}
addresses = [{% for address in network.addresses %}"{{ address }}"{%- if not loop.last -%}, {%- endif -%}{% endfor %}]

dhcp {
enabled = {{ network.dhcp_enabled | default('true') }}
enabled = {{ network.dhcp_enabled | default('true') | lower() }}
}

{% if network.dns_enabled is defined and network.dns_enabled | bool %}
dns {
enabled = {{ network.dns_enabled }}
 local_only = {{ network.dns_local_only | default('false') }}
 local_only = {{ network.dns_local_only | default('false') | lower() }}

{% for forwarder in libvirt_network.dns_forwarders %}
forwarders {
Expand Down
2 changes: 1 addition & 1 deletion templates/libvirt/vms.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource "libvirt_volume" "{{ disk.volume_id }}" {
# VM {{ vm.name }} specification
resource "libvirt_domain" "{{ vm.name }}" {
name = "{{ vm.name }}"
running = "{{ vm.running | default('true') | lower() }}"
running = {{ vm.running | default('true') | lower() }}
memory = "{{ vm.memory }}"
vcpu = "{{ vm.vcpu }}"

Expand Down

0 comments on commit d0fce7e

Please sign in to comment.