Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update module for provider compatibility version 3.0.1-rc4 #43

Merged
merged 7 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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. | <pre>list(object({<br> type = string<br> storage = string<br> size = string<br> }))</pre> | no |
| 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 |
| 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 |
<!-- END_TF_DOCS -->
13 changes: 8 additions & 5 deletions instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
26 changes: 12 additions & 14 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand All @@ -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" {
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
Loading