File tree Expand file tree Collapse file tree 3 files changed +72
-6
lines changed Expand file tree Collapse file tree 3 files changed +72
-6
lines changed Original file line number Diff line number Diff line change @@ -76,11 +76,14 @@ resource "libvirt_domain" "virt-machine" {
7676 " date"
7777 ]
7878 connection {
79- type = " ssh"
80- user = var. ssh_admin
81- host = self. network_interface [0 ]. addresses [0 ]
82- private_key = var. ssh_private_key != null ? file (var. ssh_private_key ) : null
83- timeout = " 2m"
79+ type = " ssh"
80+ user = var. ssh_admin
81+ host = self. network_interface [0 ]. addresses [0 ]
82+ private_key = try (file (var. ssh_private_key ), var. ssh_private_key , null )
83+ timeout = " 2m"
84+ bastion_host = var. bastion_host
85+ bastion_user = var. bastion_user
86+ bastion_private_key = try (file (var. bastion_ssh_private_key ), var. bastion_ssh_private_key , null )
8487 }
8588 }
8689}
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ variable "xml_override" {
7070 vendor = string
7171 product = string
7272 }))
73+ pci_devices_passthrough = list (object ({
74+ src_domain = string
75+ src_bus = string
76+ src_slot = string
77+ src_func = string
78+ dst_domain = string
79+ dst_bus = string
80+ dst_slot = string
81+ dst_func = string
82+ }))
7383 })
7484 default = {
7585
@@ -86,6 +96,18 @@ variable "xml_override" {
8696 # vendor = "0x0123",
8797 # product = "0xabcd"
8898 # }
99+ ],
100+ pci_devices_passthrough = [
101+ # {
102+ # src_domain = "0x0000",
103+ # src_bus = "0xc1",
104+ # src_slot = "0x00",
105+ # src_func = "0x0",
106+ # dst_domain = "0x0000",
107+ # dst_bus = "0x00",
108+ # dst_slot = "0x08"
109+ # dst_func = "0x0"
110+ # }
89111 ]
90112 }
91113
@@ -185,7 +207,7 @@ variable "time_zone" {
185207}
186208
187209variable "ssh_private_key" {
188- description = " Private key for SSH connection test"
210+ description = " Private key for SSH connection test (either path to file or key content) "
189211 type = string
190212 default = null
191213}
@@ -211,3 +233,21 @@ variable "graphics" {
211233 error_message = " Graphics type not supported. Only 'spice' or 'vnc' are valid options."
212234 }
213235}
236+
237+ variable "bastion_host" {
238+ description = " Bastion host"
239+ type = string
240+ default = null
241+ }
242+
243+ variable "bastion_user" {
244+ description = " Bastion ssh user"
245+ type = string
246+ default = null
247+ }
248+
249+ variable "bastion_ssh_private_key" {
250+ description = " Bastion private key for SSH connection test (either path to file or key content)"
251+ type = string
252+ default = null
253+ }
Original file line number Diff line number Diff line change 4444 < xsl: attribute name= " model" > ${usb_controller.model}< / xsl: attribute>
4545 < / xsl: element>
4646% { endfor ~}
47+ % {if pci_devices_passthrough != [] ~}
48+ % { for pci_devices in pci_devices_passthrough ~}
49+ < xsl: element name= " hostdev" >
50+ < xsl: attribute name= " type" > pci< / xsl: attribute>
51+ < xsl: attribute name= " managed" > yes< / xsl: attribute>
52+ < xsl: element name= " source" >
53+ < xsl: element name= " address" >
54+ < xsl: attribute name= " domain" > ${pci_devices.src_domain}< / xsl: attribute>
55+ < xsl: attribute name= " bus" > ${pci_devices.src_bus}< / xsl: attribute>
56+ < xsl: attribute name= " slot" > ${pci_devices.src_slot}< / xsl: attribute>
57+ < xsl: attribute name= " function" > ${pci_devices.src_func}< / xsl: attribute>
58+ < / xsl: element>
59+ < / xsl: element>
60+ < xsl: element name= " address" >
61+ < xsl: attribute name= " type" > pci< / xsl: attribute>
62+ < xsl: attribute name= " domain" > ${pci_devices.dst_domain}< / xsl: attribute>
63+ < xsl: attribute name= " bus" > ${pci_devices.dst_bus}< / xsl: attribute>
64+ < xsl: attribute name= " slot" > ${pci_devices.dst_slot}< / xsl: attribute>
65+ < xsl: attribute name= " function" > ${pci_devices.dst_func}< / xsl: attribute>
66+ < / xsl: element>
67+ < / xsl: element>
68+ % { endfor ~}
69+ % { endif ~}
4770 < / xsl: copy>
4871 < / xsl: template>
4972< / xsl: stylesheet>
You can’t perform that action at this time.
0 commit comments