Skip to content

Commit

Permalink
netboot vm from template
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Jul 4, 2023
1 parent f49c2d0 commit 57b9e42
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ resource "proxmox_virtual_environment_vm" "vm" {
datastore_id = var.disk.storage

user_account {
keys = clone.value
keys = initialization.value
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion modules/vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ variable "clone" {
}

variable "ssh_keys" {
type = string
type = list(string)
default = null
description = "clone the vm with the given ID"
}
Expand Down
7 changes: 3 additions & 4 deletions proxmox/netboot.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ module "netboot_vm" {
source = "../modules/vm"

name = "netboot"
node = var.node

# teraform provider is broken and tries to apply every time
# pool = local.pool
node = var.node
pool = var.pool

qemu_agent = true
clone = data.proxmox_virtual_environment_vm.debian_cloud_vm_template.vm_id

cores = 1
memory = 2048
Expand Down
5 changes: 5 additions & 0 deletions proxmox/templates.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ resource "proxmox_virtual_environment_file" "alpine_cloud_template" {
file_name = "alpine-3.18-cloud-amd64_20230625.tar.xz"
}
}

data "proxmox_virtual_environment_vm" "debian_cloud_vm_template" {
node_name = var.node
vm_id = 9000
}

0 comments on commit 57b9e42

Please sign in to comment.