0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00
Commit Graph

107 Commits

Author SHA1 Message Date
Anton Iacobaeus
28ae95bd09
feat(vm): add support for AMD SEV (#1952)
Signed-off-by: Anton Iacobaeus <anton.iacobaeus@canarybit.eu>
2025-05-12 21:43:15 -04:00
Pavel Boldyrev
a99220e9fb
feat(lxc): increase number of supported mount points to 256 (#1939)
* feat(lxc): increase number of supported mount points to 256
* fix(container): correct condition for setting replicate value for rootfs


Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-29 21:15:20 -04:00
Pavel Boldyrev
ebd5399e14
chore(code): fix code problems reported by Qodana (#1934)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-28 01:07:01 +00:00
Pavel Boldyrev
d46399024f
fix(file): better error message on download failure (#1923)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-23 12:34:38 -04:00
Pavel Boldyrev
7fd190aaeb
fix(vm): race condition on reboot causing inconsistent VM state (#1911)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-16 21:04:35 -04:00
Fina
55b3f7391a
feat(vm): add support for virtiofs (#1900)
Signed-off-by: Fina Wilke <code@felinira.net>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-15 13:10:37 -04:00
Pavel Boldyrev
13401465c9
fix(vm,lxc): error parsing disk ID when datastore name contains . (#1894)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-11 09:02:15 -04:00
Pavel Boldyrev
d631ccbf90
feat(vm): do not force VM re-create on initialization.user_account changes (#1885)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-07 18:56:59 -04:00
Pavel Boldyrev
b5b61b48dc
feat(datastores)!: implement new structured format and filters for datastores data source (#1875)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-04-01 17:32:29 -04:00
Pavel Boldyrev
03f2079902
fix(lxc): prevent spurious dns config change when updating initialization block (#1859)
* fix(lxc): prevent spurious `dns` config change when updating `initialization` block

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-28 22:39:57 -04:00
Pavel Boldyrev
75281b2652
chore(docs)!: clarify disk behaviour in clone operation (#1850)
This is a "meta" PR to bump the minor version due potentially breaking changes from #1840.

See documentation for more details.

> When cloning an existing virtual machine, whether it's a template or not, the
> resource will inherit the disks and other configuration from the source VM.
>
> *If* you modify any attributes of an existing disk in the clone, you also need to
> explicitly provide values for any other attributes that differ from the schema defaults
> in the source (e.g., `size`, `discard`, `cache`, `aio`).
> Otherwise, the schema defaults will take effect and override the source values.

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-26 14:48:13 -04:00
Pavel Boldyrev
09d3e97d02
fix(vm): handle update of disks moved during VM clone (#1849)
* fix(vm): handle update of disks moved during VM clone

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-26 13:12:00 -04:00
Pavel Boldyrev
faeada970c
fix(vm): fix and improve disk management for cloned VMs (#1840)
Allow to set disk speed and set / update other attributes of existing disks when cloning a VM

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-03-20 20:34:19 -04:00
Pavel Boldyrev
3119194292
feat(vm): add RNG device support (#1774)
* feat(vm): add RNG device  support

This commit adds support for configuring the Random Number Generator (RNG) device for virtual machines in both the VM resource and datasource. The implementation includes:

- New schema and model for RNG configuration
- Support for setting RNG source, max_bytes, and period
- Updated documentation for RNG configuration
- Test cases for RNG configuration
- Integration with VM creation, update, and read operations

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-02-16 23:53:40 -05:00
Pavel Boldyrev
5f003143f8
feat(vm): deprecate enabled attribute on cdrom/disk devices (#1746)
* feat(vm): deprecate `enabled` attribute on `cdrom`/`disk` devices

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* docs(vm): update CDROM configuration terminology and deprecation note

Improve documentation for virtual machine CD-ROM configuration by:
- Correcting capitalization of "CD-ROM"
- Clarifying deprecation note for `enabled` attribute

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-02-07 22:50:57 -05:00
Petr Gajdosik
7cbd1b46fa
feat(lxc): add support for device_passthrough config option (#1706)
Signed-off-by: Tarasa24 <tarasa24@tarasa24.dev>
2025-01-16 17:58:49 -05:00
Pavel Boldyrev
c57dc78119
fix(vm): do not delete a VM during retry on create (#1711)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2025-01-13 20:40:16 -05:00
Pavel Boldyrev
9d2118d762
fix(vm): retry start if it fails with a transient error (#1685)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-12-17 14:31:46 -05:00
Pavel Boldyrev
bf9e2436d4
fix(vm): edge case of deleting incomplete VM if create fails and provider retries (#1684)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-12-17 14:27:30 -05:00
Björn Brauer
3e025fd6c8
feat(node): add support for node config API (#1482)
* feat(node): implement CRUD API for proxmox node config

Signed-off-by: Björn Brauer <zaubernerd@zaubernerd.de>

* fix: add unit tests, fix UnmarshalJSON

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Björn Brauer <zaubernerd@zaubernerd.de>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-11-25 19:50:01 -05:00
Pavel Boldyrev
d92710d0b5
fix(vm): add retries to VM update operation (#1650)
* fix(vm): add retries to VM `update` operation

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-11-21 22:28:10 -05:00
Pavel Boldyrev
d226b59e2e
feat(vm): add support for watchdog (#1556)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-30 11:14:55 -04:00
Pavel Boldyrev
569db6df3b
fix(vm): handle more than 4 hostpci devices (#1543)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-20 19:04:45 -04:00
renovate[bot]
6635c89f63
chore(deps): update tools (#1490)
* chore(deps): update tools

| datasource     | package                           | from    | to      |
| -------------- | --------------------------------- | ------- | ------- |
| go             | github.com/golangci/golangci-lint | v1.59.1 | v1.60.1 |
| golang-version | go                                | 1.22.6  | 1.23.0  |

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* fix: linter errors

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

* fix: 1.23.0 in the main `go.mod`

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-08-19 13:48:39 -04:00
Keith
e8bd1fcda7
fix(storage): ignore os.ErrClosed from deferred fileReader.Close() in storage.APIUpload (#1468)
fix(provider): ignore `ErrClosed` for fileReader

Signed-off-by: Keith King <KingKeithC@gmail.com>
2024-08-06 22:36:24 -04:00
Pavel Boldyrev
fc42ac3a5e
fix(vm): panic when reading VM with SPICE USB passthrough (#1438)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-11 18:38:43 -04:00
Pavel Boldyrev
d193abd33e
fix(vm): improve reliability of VM create / get operations (#1431)
* fix(vm): improve reliability of VM create / get operations

- Add retries to GET API calls, fix retrying on POST (VM create) API calls.
- Minor fix in acceptance tests

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-08 18:17:53 +00:00
Sven Greb
357f7c70a7
feat(node): implement initial support to manage APT repositories (#1325)
* feat(nodes): Initial support to manage APT repositories

> Summary

This commit implements initial support for managing APT repositories
which is (currently) limited to…

- …adding "standard" repositories to allow to configure it.
- toggling the activation status (enabled/disabled) of any configured
  repository.

+ !WARNING!
+ Note that deleting or modifying a repository in any other way is
+ (sadly) not possible (yet?)!
+ The limited functionality is due to the (current) capabilities of
+ the Proxmox VE APT repository API [1] itself.

>> Why are there two resources for one API entity?

Even though an APT repository should be seen as a single API entity, it
was required to implement standard repositories as dedicated
`proxmox_virtual_environment_apt_standard_repository`. This is because
standard repositories must be configured (added) first to the default
source list files because their activation status can be toggled. This
is handled by the HTTP `PUT` request, but the modifying request is
`POST` which would require two calls within the same Terraform execution
cycle. I tried to implement it in a single resource and it worked out
mostly after some handling some edges cases, but in the end there were
still too many situations an edge cases where it might break due to
Terraform state drifts between states. In the end the dedicated
resources are way cleaner and easier to use without no complexity and
conditional attribute juggling for practitioners.

>> Other "specialties"

Unfortunately the Proxmox VE API responses to HTTP `GET` requests with
four larger arrays which are, more or less, kind of connected to each
other, but they also somehow stand on their own. This means that there
is a `files` array that contains the `repositories` again which again
contains all repositories with their metadata of every source file. On
the other hand available standard repositories are listed in the
`standard-repos` array, but their activation status is only stored when
they have already been added through a `PUT` request. The `infos` array
is more less useless.

So in order to get the required data and store them in the state the
`importFromAPI` methods of the models must loop through all the
deep-nested arrays and act based on specific attributes like a matching
file path, comparing it to the activation status and so on.

In the end the implementation is really stable after testing it with all
possible conditions and state combinations.

@bpg if you'd like me to create a small data logic flow chart to make it
easier to understand some parts of the code let me know. I can make my
local notes "shareable" which I created to not loose track of the logic.

>> What is the way to manage the activation status of a "standard" repository?

Because the two resources are modular and scoped they can be simply
combined to manage an APT "standard" repository, e.g. toggling its
activation status. The following examples are also included in the
documentations.

```hcl
// This resource ensure that the "no-subscription" standard repository
// is added to the source list.
// It represents the `PUT` API request.
resource "proxmox_virtual_environment_apt_standard_repository" "example" {
  handle = "no-subscription"
  node   = "pve"
}

// This resource allows to actually modify the activation status of the
// standard repository as it represents the `POST`.
// Using the values from the dedicated standard repository resource
// makes sure that Terraform correctly resolves dependency order.
resource "proxmox_virtual_environment_apt_repository" "example" {
  enabled   = true
  file_path = proxmox_virtual_environment_apt_standard_repository.example.file_path
  index     = proxmox_virtual_environment_apt_standard_repository.example.index
  node      = proxmox_virtual_environment_apt_standard_repository.example.node
}
```

[1]: https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/apt/repositories

---------

Signed-off-by: Sven Greb <development@svengreb.de>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-05 18:48:35 -04:00
Konstantin Kornienko
65f8ba5bfe
feat(vm): implement filtering in vms data source. (#1423)
* feat(vm): implement filtering in vms data source.

* Additional attributes for vm data source (status, template)

* fix qodana CI job condition

---------

Signed-off-by: Konstantin Kornienko <konstantin.kornienko@gmail.com>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-05 15:52:39 -04:00
Pavel Boldyrev
4f70459c26
chore(code): fix code quality warnings (#1409)
* chore(code): fix code quality warnings

+ re-enable Qodana on PRs

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-25 00:47:50 -04:00
Pavel Boldyrev
cc7fc63ec1
chore(vm): refactor storage devices handling from/to API (#1394)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-17 01:23:48 +00:00
Pavel Boldyrev
de349523fe
feat(vm): add support for disk.serial attribute (#1385)
* feat(vm): add support for `disk.serial` attribute

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-11 01:40:03 +00:00
Pavel Boldyrev
8892118228
misc: restore 0.59.1 code
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-09 23:40:27 -04:00
Pavel Boldyrev
80cafa689f
feat(vm2): add initial support for cdrom (#1370)
feat(vm2): add initial support for `cdrom`

This is a breaking change comparing to v1 - switching the cdrom schema from a nested block to a nested attribute map.

Improvements comparing to v1:
- support for `ide`, `sata`, `scsi` interfaces
- support for multiple cdroms

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-10 01:28:18 +00:00
Pavel Boldyrev
580381f892
chore(api): refactor nodes/vms/vms_types.go: split into multiple files (#1368)
Split all `Custom*` structs and marshaling code into separate files from `vms_types.go`

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-09 04:11:16 +00:00
Pavel Boldyrev
5d4193b6be
fix(vm): ignore 599 task status response when waiting for VM start (#1365)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-07 01:50:18 +00:00
Karlie Meads
76d980683c
fix(vm): host parameter is optional if using mapping for usb (#1338)
Signed-off-by: Karlie Meads <68717336+karliemeads@users.noreply.github.com>
2024-05-29 21:03:03 -04:00
Pavel Boldyrev
d843e46b37
misc(vm2): add support for vga (#1328)
* misc(vm2): add support for `vga`
* fix: use random VM IDs in parallel acc tests

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-27 21:30:12 -04:00
Rudolf Tammekivi
b7afd02cc3
fix(vm): check task warning status against exit code (#1330)
Signed-off-by: Rudolf Tammekivi <rudolf.tammekivi@guardtime.com>
2024-05-27 21:34:41 +00:00
Pavel Boldyrev
32de050605
feat(vm): add support for vga.clipboard, virtio-gl type (#1326)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-26 21:08:04 +00:00
Pavel Boldyrev
fb1105d93b
fix(vm): allow clone to pass with warnings (#1317)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-22 00:41:49 +00:00
Pavel Boldyrev
a6c6b98d44
fix(file): upload timeout with 596 response code (#1315)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-21 23:31:02 +00:00
Pavel Boldyrev
aa309fd9ea
chore(vm2): add support for cpu (#1310)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-18 04:52:02 +00:00
Pavel Boldyrev
2b7dd08020
feat(vm): remove support for initialization.upgrade attribute (#1295)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-15 00:55:29 +00:00
Pavel Boldyrev
920a4cd415
misc(vm): fix CustomBool conversion bug introduced in acl implementation (#1286)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-12 12:49:24 +00:00
hrmny
afcbb415a3
feat(access): add ACL resource (#1166)
* feat: add ACL resource

Signed-off-by: hrmny <8845940+ForsakenHarmony@users.noreply.github.com>

* chore: move code under /access, cleanup acc tests

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: hrmny <8845940+ForsakenHarmony@users.noreply.github.com>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-08 20:22:15 -04:00
Pavel Boldyrev
7209fe0321
chore(vm2): experimental support for clone and inherited attributes (#1235)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-24 02:00:11 +00:00
Pavel Boldyrev
d8202dd7a1
chore(vm2): initial experimental VM resource implementation using Plugin Framework (#1230)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-19 21:57:12 +00:00
renovate[bot]
938784531f
chore(deps): update module github.com/avast/retry-go/v4 (v4.5.1 → v4.6.0) (#1229)
* chore(deps): update module github.com/avast/retry-go/v4 (v4.5.1 → v4.6.0)

| datasource | package                      | from   | to     |
| ---------- | ---------------------------- | ------ | ------ |
| go         | github.com/avast/retry-go/v4 | v4.5.1 | v4.6.0 |

* switch to `retry.UntilSucceeded()`

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-19 16:48:38 +00:00
Pavel Boldyrev
0c9c2066fd
fix(vm,lxc,file): improve timeouts handling (#1222)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-04-19 12:38:16 -04:00