Skip to content

Commit

Permalink
Merge pull request #15 from FriedCircuits/feature/Proxmox-Extra-Disks
Browse files Browse the repository at this point in the history
Proxmox Extra Disks
  • Loading branch information
FriedCircuits authored Apr 28, 2022
2 parents f3b8f80 + 2c845bd commit e5a2e0b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.0.13
v0.0.14
33 changes: 21 additions & 12 deletions modules/proxmox/vm-clone/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 1.0"
required_providers {
proxmox = {
source = "Telmate/proxmox"
source = "Telmate/proxmox"
version = "~>2.9"
}
}
Expand All @@ -14,10 +14,10 @@ resource "null_resource" "cloud_init" {
}

connection {
type = "ssh"
user = var.pve_connection.ssh_user
type = "ssh"
user = var.pve_connection.ssh_user
private_key = var.pve_connection.private_key
host = var.pve_connection.host
host = var.pve_connection.host
}

provisioner "file" {
Expand All @@ -36,26 +36,35 @@ resource "proxmox_vm_qemu" "vm" {
onboot = var.onboot
oncreate = var.oncreate

clone = var.clone
clone = var.clone
full_clone = var.full_clone

disk {
slot = 0
slot = 0
storage = var.specs.disk_storage
type = var.specs.disk_type
size = var.specs.disk_size
type = var.specs.disk_type
size = var.specs.disk_size
}

cores = var.specs.cores
dynamic "disk" {
for_each = var.extra_disks != null ? var.extra_disks : []
content {
storage = disk.value["storage"]
type = disk.value["type"]
size = disk.value["size"]
}
}

cores = var.specs.cores
sockets = var.specs.sockets
memory = var.specs.memory
memory = var.specs.memory

network {
model = "virtio"
model = "virtio"
bridge = "vmbr0"
}

os_type = "cloud-init"
os_type = "cloud-init"
ipconfig0 = "ip=dhcp"

cicustom = "user=local:snippets/cloud_init_${var.vm.name}.yml"
Expand Down
16 changes: 13 additions & 3 deletions modules/proxmox/vm-clone/variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "pve_connection" {
description = "Connection info for PVE host."
type = object({
type = object({
node = string
host = string
ssh_user = string
Expand All @@ -15,7 +15,7 @@ variable "clone" {

variable "vm" {
description = "Name of VM to deploy."
type = object({
type = object({
name = string
description = string
})
Expand All @@ -41,7 +41,7 @@ variable "agent_enabled" {

variable "specs" {
description = "CPU, Mem settings per VM."
type = object({
type = object({
cores = number
sockets = number
memory = number
Expand All @@ -59,6 +59,16 @@ variable "specs" {
}
}

variable "extra_disks" {
description = "Add extra disk to create and attach to the VM."
type = list(object({
storage = string
type = string
size = string
}))
default = []
}

variable "tags" {
description = "Comma delimited strings to pass as tags to the vm. Note not visable in the UI."
type = string
Expand Down

0 comments on commit e5a2e0b

Please sign in to comment.