Skip to content

Commit 266fa35

Browse files
feat: add 2 VMs for saces (#16)
1 parent 80f2acd commit 266fa35

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

modules/vm/main.tf

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ resource "proxmox_virtual_environment_vm" "vm" {
1919
cpu {
2020
cores = var.cores
2121
// "x86-64-v2-AES" is best if live migration is needed
22-
type = "host"
23-
numa = true
22+
type = "host"
23+
numa = true
24+
units = var.weight
2425
}
2526

2627
memory {
27-
dedicated = var.memory
28+
dedicated = min(1024, var.memory)
29+
floating = var.memory
2830
}
2931

3032
bios = "ovmf"

modules/vm/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ variable "cores" {
2828
description = "how many cores the VM should have"
2929
}
3030

31+
variable "weight" {
32+
type = number
33+
default = 1024
34+
description = "CPU shares/weight (defaults to 1024)"
35+
}
36+
3137
variable "machine" {
3238
type = string
3339
default = "q35"

proxmox/106-streaming.tf

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module "streaming_vm" {
2+
source = "../modules/vm"
3+
node = var.node
4+
pool = var.pool
5+
6+
name = "streaming"
7+
vm_id = "106"
8+
9+
clone = data.proxmox_virtual_environment_vm.debian_cloud_vm_template.vm_id
10+
11+
cores = 2
12+
memory = 4096
13+
14+
disk = {
15+
// gigabytes
16+
size = 32
17+
storage = var.storage.disk
18+
}
19+
20+
network = {
21+
bridge = var.network.bridge
22+
internal_bridge = proxmox_virtual_environment_network_linux_bridge.internal_bridge.name
23+
}
24+
25+
admins = [
26+
local.users["saces"]
27+
]
28+
}

proxmox/107-ci-runners.tf

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module "ci_runners_vm" {
2+
source = "../modules/vm"
3+
node = var.node
4+
pool = var.pool
5+
6+
name = "ci-runners"
7+
vm_id = "107"
8+
9+
clone = data.proxmox_virtual_environment_vm.debian_cloud_vm_template.vm_id
10+
11+
cores = 4
12+
memory = 4096
13+
weight = 128
14+
15+
disk = {
16+
// gigabytes
17+
size = 32
18+
storage = var.storage.disk
19+
}
20+
21+
network = {
22+
bridge = var.network.bridge
23+
internal_bridge = proxmox_virtual_environment_network_linux_bridge.internal_bridge.name
24+
}
25+
26+
admins = [
27+
local.users["saces"]
28+
]
29+
}

0 commit comments

Comments
 (0)