Skip to content

Commit f32e2a1

Browse files
authored
update module for provider compatibility version 3.0.1-rc4 (#43)
* update module for provider compatibility version 3.0.1-rc4 * update readme * rework disk block * remove disks default * make disk type variable * update readme * update minimum terraform version
1 parent 7cde7a8 commit f32e2a1

File tree

5 files changed

+32
-27
lines changed

5 files changed

+32
-27
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Update `proxmox` provider to `3.0.1-rc4`.
13+
- Refactor disks implementation for upstream provider.
14+
1015
## [1.8.0] - 2023-04-03
1116

1217
### Added

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ This module is an opinionated take on creating a VM in Proxmox; not all possible
1111

1212
| Name | Version |
1313
|------|---------|
14-
| terraform | >= 0.14.0 |
15-
| proxmox | >= 2.9.14 |
14+
| terraform | >= 1.3.0 |
15+
| proxmox | >= 3.0.1-rc4 |
1616

1717
## Providers
1818

1919
| Name | Version |
2020
|------|---------|
21-
| proxmox | 2.9.11 |
21+
| proxmox | 2.9.13 |
2222

2323
## Resources
2424

@@ -42,15 +42,14 @@ This module is an opinionated take on creating a VM in Proxmox; not all possible
4242
| boot | Boot order for the instance. | `string` | no |
4343
| cicustom | Path(s) to cloud-init config files (ignored when pxe_boot is true). | `string` | no |
4444
| clone | Name of the template to clone (ignored when pxe_boot is true). | `string` | no |
45-
| cloudinit_cdrom_storage | Name of the storage to create the cloud-init image in (e.g. local-lvm). | `string` | no |
4645
| cpu | The type of CPU to emulate in the guest. | `string` | no |
47-
| disks | List of objects representing additional disks. | <pre>list(object({<br> type = string<br> storage = string<br> size = string<br> }))</pre> | no |
46+
| disks | List of objects representing additional disks. | <pre>list(object({<br> discard = optional(bool)<br> emulatessd = optional(bool)<br> iothread = optional(bool)<br> size = optional(string)<br> slot = optional(string)<br> storage = string<br> type = string<br> }))</pre> | no |
4847
| full_clone | Create a full clone; if false, a linked clone will be created (ignored when pxe_boot is true). | `bool` | no |
4948
| hagroup | The HA group identifier the resource belongs to. | `string` | no |
5049
| hastate | Requested HA state for the resource. | `string` | no |
5150
| onboot | Whether to have the VM startup after the PVE node starts. | `bool` | no |
52-
| oncreate | Whether to have the VM startup after the VM is created. | `bool` | no |
5351
| os_type | Type of OS for preprovisioning. | `string` | no |
5452
| pxe_boot | Set PXE boot mode | `bool` | no |
5553
| qemu_agent | Enable QEMU guest agent (must be installed in the template). Set to `1` to enable or `0` to disable. | `number` | no |
54+
| vm_state | Desired power state of the VM. | `string` | no |
5655
<!-- END_TF_DOCS -->

instance.tf

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resource "proxmox_vm_qemu" "proxmox_instance" {
99
pxe = var.pxe_boot
1010
boot = var.boot
1111
onboot = var.onboot
12-
oncreate = var.oncreate
12+
vm_state = var.vm_state
1313

1414
agent = var.qemu_agent
1515

@@ -37,14 +37,17 @@ resource "proxmox_vm_qemu" "proxmox_instance" {
3737
dynamic "disk" {
3838
for_each = var.disks
3939
content {
40-
type = disk.value.type
41-
storage = disk.value.storage
42-
size = disk.value.size
40+
discard = disk.value.discard
41+
emulatessd = disk.value.emulatessd
42+
iothread = disk.value.iothread
43+
size = disk.value.size
44+
slot = disk.value.slot
45+
storage = disk.value.storage
46+
type = disk.value.type
4347
}
4448
}
4549

4650
os_type = var.pxe_boot == true ? null : var.os_type
4751
cicustom = var.pxe_boot == true ? null : var.cicustom
4852
# 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}"
49-
cloudinit_cdrom_storage = var.pxe_boot == true ? null : var.cloudinit_cdrom_storage
5053
}

variables.tf

+12-14
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ variable "onboot" {
103103
type = bool
104104
}
105105

106-
variable "oncreate" {
107-
default = null
108-
description = "Whether to have the VM startup after the VM is created."
109-
type = bool
106+
variable "vm_state" {
107+
default = "running"
108+
description = "Desired power state of the VM."
109+
type = string
110110
}
111111

112112
variable "network_interfaces" {
@@ -120,13 +120,17 @@ variable "network_interfaces" {
120120
}
121121

122122
variable "disks" {
123-
default = null
124123
description = "List of objects representing additional disks."
125124
type = list(object({
126-
type = string
127-
storage = string
128-
size = string
125+
discard = optional(bool)
126+
emulatessd = optional(bool)
127+
iothread = optional(bool)
128+
size = optional(string)
129+
slot = optional(string)
130+
storage = string
131+
type = string
129132
}))
133+
default = []
130134
}
131135

132136
variable "os_type" {
@@ -140,9 +144,3 @@ variable "cicustom" {
140144
description = "Path(s) to cloud-init config files (ignored when pxe_boot is true)."
141145
type = string
142146
}
143-
144-
variable "cloudinit_cdrom_storage" {
145-
default = null
146-
description = "Name of the storage to create the cloud-init image in (e.g. local-lvm)."
147-
type = string
148-
}

versions.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 0.14.0"
2+
required_version = ">= 1.3.0"
33

44
required_providers {
55
proxmox = {
66
source = "Telmate/proxmox"
7-
version = ">= 2.9.14"
7+
version = ">= 3.0.1-rc4"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)