Skip to content

Commit bbcf083

Browse files
committed
Added graphics variable
Add the variable var.graphics to allow overriding the default graphics type of 'spice' with 'vnc' which is compatible with RHEL9.
1 parent 36b1662 commit bbcf083

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ No modules.
5252
| <a name="input_bridge"></a> [bridge](#input\_bridge) | Bridge interface | `string` | `"virbr0"` | no |
5353
| <a name="input_cpu_mode"></a> [cpu\_mode](#input\_cpu\_mode) | CPU mode | `string` | `"host-passthrough"` | no |
5454
| <a name="input_dhcp"></a> [dhcp](#input\_dhcp) | Use DHCP or Static IP settings | `bool` | `false` | no |
55+
| <a name="input_graphics"></a> [graphics](#graphics) | Graphics type (can be '`spice`' or '`vnc`') | `string` | `spice` | no |
5556
| <a name="input_index_start"></a> [index\_start](#input\_index\_start) | From where the indexig start | `number` | `1` | no |
5657
| <a name="input_ip_address"></a> [ip\_address](#input\_ip\_address) | List of IP addresses | `list(string)` | <pre>[<br> "192.168.123.101"<br>]</pre> | no |
5758
| <a name="input_ip_gateway"></a> [ip\_gateway](#input\_ip\_gateway) | IP addresses of a gateway | `string` | `"192.168.123.1"` | no |

examples/basic/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "test_nodes" {
1111
memory = "512"
1212
vcpu = 1
1313
system_volume = 20
14+
graphics = "vnc"
1415
ssh_admin = "admin"
1516
ssh_private_key = "~/.ssh/your_key_id_ed25519"
1617
ssh_keys = [

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ resource "libvirt_domain" "virt-machine" {
6565
}
6666

6767
graphics {
68-
type = "spice"
68+
type = var.graphics
6969
listen_type = "address"
7070
autoport = true
7171
}

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,14 @@ variable "runcmd" {
200200
"[ systemctl, restart, systemd-networkd ]"
201201
]
202202
}
203+
204+
variable "graphics" {
205+
description = "Graphics type"
206+
type = string
207+
default = "spice"
208+
209+
validation {
210+
condition = contains(["spice", "vnc"], var.graphics)
211+
error_message = "Graphics type not supported. Only 'spice' or 'vnc' are valid options."
212+
}
213+
}

0 commit comments

Comments
 (0)