Skip to content

Commit 59dcdcf

Browse files
commit
1 parent 622b70b commit 59dcdcf

2 files changed

Lines changed: 47 additions & 6 deletions

File tree

push-templates.sh

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ WORKSPACES=(
1212
"Maker"
1313
"Minimal"
1414
"OpenClaw"
15+
"ProxmoxVM"
1516
)
1617

1718
ICON_BASE_URL="https://raw.githubusercontent.com/makespacemadrid/coder-workspaces/main"
@@ -23,7 +24,45 @@ for ws in "${WORKSPACES[@]}"; do
2324
continue
2425
fi
2526
echo ">> Pushing template ${ws}..."
26-
coder templates push --yes --directory "$dir"
27+
if [ "$ws" = "ProxmoxVM" ]; then
28+
required_vars=(
29+
TF_VAR_proxmox_api_url
30+
TF_VAR_proxmox_api_token_id
31+
TF_VAR_proxmox_api_token_secret
32+
TF_VAR_proxmox_host
33+
TF_VAR_proxmox_password
34+
TF_VAR_proxmox_ssh_user
35+
TF_VAR_proxmox_node
36+
TF_VAR_disk_storage
37+
TF_VAR_snippet_storage
38+
TF_VAR_bridge
39+
TF_VAR_vlan
40+
TF_VAR_clone_template_vmid
41+
)
42+
43+
for v in "${required_vars[@]}"; do
44+
if [ -z "${!v:-}" ]; then
45+
echo "Missing required env var for ProxmoxVM push: ${v}" >&2
46+
exit 1
47+
fi
48+
done
49+
50+
coder templates push --yes --directory "$dir" \
51+
--variable "proxmox_api_url=${TF_VAR_proxmox_api_url}" \
52+
--variable "proxmox_api_token_id=${TF_VAR_proxmox_api_token_id}" \
53+
--variable "proxmox_api_token_secret=${TF_VAR_proxmox_api_token_secret}" \
54+
--variable "proxmox_host=${TF_VAR_proxmox_host}" \
55+
--variable "proxmox_password=${TF_VAR_proxmox_password}" \
56+
--variable "proxmox_ssh_user=${TF_VAR_proxmox_ssh_user}" \
57+
--variable "proxmox_node=${TF_VAR_proxmox_node}" \
58+
--variable "disk_storage=${TF_VAR_disk_storage}" \
59+
--variable "snippet_storage=${TF_VAR_snippet_storage}" \
60+
--variable "bridge=${TF_VAR_bridge}" \
61+
--variable "vlan=${TF_VAR_vlan}" \
62+
--variable "clone_template_vmid=${TF_VAR_clone_template_vmid}"
63+
else
64+
coder templates push --yes --directory "$dir"
65+
fi
2766

2867
icon_path="$dir/icon.svg"
2968
if [ -f "$icon_path" ]; then

workspaces/ProxmoxVM/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ variable "clone_template_vmid" {
131131
}
132132
}
133133

134+
variable "clone_full" {
135+
description = "Use full clone. Set false only when the template disk storage supports linked clones."
136+
type = bool
137+
default = true
138+
}
139+
134140
data "coder_workspace" "me" {}
135141
data "coder_workspace_owner" "me" {}
136142

@@ -239,7 +245,7 @@ resource "proxmox_virtual_environment_vm" "workspace" {
239245
clone {
240246
node_name = var.proxmox_node
241247
vm_id = var.clone_template_vmid
242-
full = false
248+
full = var.clone_full
243249
retries = 5
244250
}
245251

@@ -250,10 +256,6 @@ resource "proxmox_virtual_environment_vm" "workspace" {
250256
on_boot = true
251257
started = true
252258

253-
startup {
254-
order = 1
255-
}
256-
257259
scsi_hardware = "virtio-scsi-pci"
258260
boot_order = ["scsi0", "ide2"]
259261

0 commit comments

Comments
 (0)