diff --git a/README.md b/README.md index fce39d4..6cea0f8 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ No modules. | [bridge](#input\_bridge) | Bridge interface | `string` | `"virbr0"` | no | | [cpu\_mode](#input\_cpu\_mode) | CPU mode | `string` | `"host-passthrough"` | no | | [dhcp](#input\_dhcp) | Use DHCP or Static IP settings | `bool` | `false` | no | +| [graphics](#graphics) | Graphics type (can be '`spice`' or '`vnc`') | `string` | `spice` | no | | [index\_start](#input\_index\_start) | From where the indexig start | `number` | `1` | no | | [ip\_address](#input\_ip\_address) | List of IP addresses | `list(string)` |
[| no | | [ip\_gateway](#input\_ip\_gateway) | IP addresses of a gateway | `string` | `"192.168.123.1"` | no | diff --git a/examples/basic/main.tf b/examples/basic/main.tf index c33b5ac..862f5bf 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -11,6 +11,7 @@ module "test_nodes" { memory = "512" vcpu = 1 system_volume = 20 + graphics = "vnc" ssh_admin = "admin" ssh_private_key = "~/.ssh/your_key_id_ed25519" ssh_keys = [ diff --git a/main.tf b/main.tf index 4580896..6ed0426 100644 --- a/main.tf +++ b/main.tf @@ -65,7 +65,7 @@ resource "libvirt_domain" "virt-machine" { } graphics { - type = "spice" + type = var.graphics listen_type = "address" autoport = true } diff --git a/variables.tf b/variables.tf index 16163e3..bbd54d3 100644 --- a/variables.tf +++ b/variables.tf @@ -200,3 +200,14 @@ variable "runcmd" { "[ systemctl, restart, systemd-networkd ]" ] } + +variable "graphics" { + description = "Graphics type" + type = string + default = "spice" + + validation { + condition = contains(["spice", "vnc"], var.graphics) + error_message = "Graphics type not supported. Only 'spice' or 'vnc' are valid options." + } +}
"192.168.123.101"
]