Add machine variable to terraform module (#179)

* add variable machine to enable/disable secure boot

* add role description
This commit is contained in:
leongross 2022-05-30 10:29:34 +02:00 committed by GitHub
parent b84d8add73
commit 15e668d09b
5 changed files with 18 additions and 2 deletions

View File

@ -18,6 +18,7 @@ constellation_coreos_image_qcow2="/path/to/image.qcow2"
# memory=2048
# state_disk_size=10
# ip_range_start=100
# machine="q35"
```
Create terraform resources from within terraform workspace (`terraform/libvirt`):

View File

@ -23,6 +23,7 @@ module "control_plane" {
network_id = libvirt_network.constellation.id
pool = libvirt_pool.cluster.name
boot_volume_id = libvirt_volume.constellation_coreos_image.id
machine = var.machine
}
module "worker" {
@ -37,6 +38,7 @@ module "worker" {
network_id = libvirt_network.constellation.id
pool = libvirt_pool.cluster.name
boot_volume_id = libvirt_volume.constellation_coreos_image.id
machine = var.machine
}
resource "libvirt_pool" "cluster" {

View File

@ -16,7 +16,7 @@ resource "libvirt_domain" "instance_group" {
count = var.amount
memory = var.memory
vcpu = var.vcpus
machine = "q35"
machine = var.machine
tpm {
backend_type = "emulator"
backend_version = "2.0"

View File

@ -44,5 +44,11 @@ variable "boot_volume_id" {
}
variable "role" {
type = string
type = string
description = "role of the node in the constellation. either 'control-plane' or 'worker'"
}
variable "machine" {
type = string
description = "machine type. use 'q35' for secure boot and 'pc' for non secure boot. See 'qemu-system-x86_64 -machine help'"
}

View File

@ -38,3 +38,10 @@ variable "ip_range_start" {
default = 100
description = "first ip address to use within subnet"
}
variable "machine" {
type = string
default = "q35"
description = "machine type. use 'q35' for secure boot and 'pc' for non secure boot. See 'qemu-system-x86_64 -machine help'"
}