File tree 3 files changed +72
-6
lines changed
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" {
76
76
" date"
77
77
]
78
78
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 )
84
87
}
85
88
}
86
89
}
Original file line number Diff line number Diff line change @@ -70,6 +70,16 @@ variable "xml_override" {
70
70
vendor = string
71
71
product = string
72
72
}))
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
+ }))
73
83
})
74
84
default = {
75
85
@@ -86,6 +96,18 @@ variable "xml_override" {
86
96
# vendor = "0x0123",
87
97
# product = "0xabcd"
88
98
# }
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
+ # }
89
111
]
90
112
}
91
113
@@ -185,7 +207,7 @@ variable "time_zone" {
185
207
}
186
208
187
209
variable "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) "
189
211
type = string
190
212
default = null
191
213
}
@@ -211,3 +233,21 @@ variable "graphics" {
211
233
error_message = " Graphics type not supported. Only 'spice' or 'vnc' are valid options."
212
234
}
213
235
}
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 44
44
< xsl: attribute name= " model" > ${usb_controller.model}< / xsl: attribute>
45
45
< / xsl: element>
46
46
% { 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 ~}
47
70
< / xsl: copy>
48
71
< / xsl: template>
49
72
< / xsl: stylesheet>
You can’t perform that action at this time.
0 commit comments