diff --git a/CHANGELOG.md b/CHANGELOG.md index 97e2b2a..7aceeb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Update `proxmox` provider to `3.0.1-rc4`. +- Refactor disks implementation for upstream provider. + ## [1.8.0] - 2023-04-03 ### Added diff --git a/README.md b/README.md index 9fe22a3..a0dda09 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ This module is an opinionated take on creating a VM in Proxmox; not all possible | Name | Version | |------|---------| -| terraform | >= 0.14.0 | -| proxmox | >= 2.9.14 | +| terraform | >= 1.3.0 | +| proxmox | >= 3.0.1-rc4 | ## Providers | Name | Version | |------|---------| -| proxmox | 2.9.11 | +| proxmox | 2.9.13 | ## Resources @@ -42,15 +42,14 @@ This module is an opinionated take on creating a VM in Proxmox; not all possible | boot | Boot order for the instance. | `string` | no | | cicustom | Path(s) to cloud-init config files (ignored when pxe_boot is true). | `string` | no | | clone | Name of the template to clone (ignored when pxe_boot is true). | `string` | no | -| cloudinit_cdrom_storage | Name of the storage to create the cloud-init image in (e.g. local-lvm). | `string` | no | | cpu | The type of CPU to emulate in the guest. | `string` | no | -| disks | List of objects representing additional disks. |
list(object({
type = string
storage = string
size = string
}))
| no | +| disks | List of objects representing additional disks. |
list(object({
discard = optional(bool)
emulatessd = optional(bool)
iothread = optional(bool)
size = optional(string)
slot = optional(string)
storage = string
type = string
}))
| no | | full_clone | Create a full clone; if false, a linked clone will be created (ignored when pxe_boot is true). | `bool` | no | | hagroup | The HA group identifier the resource belongs to. | `string` | no | | hastate | Requested HA state for the resource. | `string` | no | | onboot | Whether to have the VM startup after the PVE node starts. | `bool` | no | -| oncreate | Whether to have the VM startup after the VM is created. | `bool` | no | | os_type | Type of OS for preprovisioning. | `string` | no | | pxe_boot | Set PXE boot mode | `bool` | no | | qemu_agent | Enable QEMU guest agent (must be installed in the template). Set to `1` to enable or `0` to disable. | `number` | no | +| vm_state | Desired power state of the VM. | `string` | no | diff --git a/instance.tf b/instance.tf index bec6999..5f12aa1 100644 --- a/instance.tf +++ b/instance.tf @@ -9,7 +9,7 @@ resource "proxmox_vm_qemu" "proxmox_instance" { pxe = var.pxe_boot boot = var.boot onboot = var.onboot - oncreate = var.oncreate + vm_state = var.vm_state agent = var.qemu_agent @@ -37,14 +37,17 @@ resource "proxmox_vm_qemu" "proxmox_instance" { dynamic "disk" { for_each = var.disks content { - type = disk.value.type - storage = disk.value.storage - size = disk.value.size + discard = disk.value.discard + emulatessd = disk.value.emulatessd + iothread = disk.value.iothread + size = disk.value.size + slot = disk.value.slot + storage = disk.value.storage + type = disk.value.type } } os_type = var.pxe_boot == true ? null : var.os_type cicustom = var.pxe_boot == true ? null : var.cicustom # example: "user=${local.citemplate_storage}:${local.snippet_dir}/user-${local.snippet_file_base},network=${local.citemplate_storage}:${local.snippet_dir}/network-${local.snippet_file_base}" - cloudinit_cdrom_storage = var.pxe_boot == true ? null : var.cloudinit_cdrom_storage } diff --git a/variables.tf b/variables.tf index bccfd8e..a42d72d 100644 --- a/variables.tf +++ b/variables.tf @@ -103,10 +103,10 @@ variable "onboot" { type = bool } -variable "oncreate" { - default = null - description = "Whether to have the VM startup after the VM is created." - type = bool +variable "vm_state" { + default = "running" + description = "Desired power state of the VM." + type = string } variable "network_interfaces" { @@ -120,13 +120,17 @@ variable "network_interfaces" { } variable "disks" { - default = null description = "List of objects representing additional disks." type = list(object({ - type = string - storage = string - size = string + discard = optional(bool) + emulatessd = optional(bool) + iothread = optional(bool) + size = optional(string) + slot = optional(string) + storage = string + type = string })) + default = [] } variable "os_type" { @@ -140,9 +144,3 @@ variable "cicustom" { description = "Path(s) to cloud-init config files (ignored when pxe_boot is true)." type = string } - -variable "cloudinit_cdrom_storage" { - default = null - description = "Name of the storage to create the cloud-init image in (e.g. local-lvm)." - type = string -} diff --git a/versions.tf b/versions.tf index 54b7164..b945a56 100644 --- a/versions.tf +++ b/versions.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.14.0" + required_version = ">= 1.3.0" required_providers { proxmox = { source = "Telmate/proxmox" - version = ">= 2.9.14" + version = ">= 3.0.1-rc4" } } }