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

108 Commits

Author SHA1 Message Date
Pavel Boldyrev
106bcd2ff9
fix(vm): add validation for node_name values (#1659)
* fix(vm): add validation for `node_name` values

Also, fix acceptance tests that now fail on PVE 8.3

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-11-27 21:23:27 -05:00
Qlem
e29dc5364f
feat(vm): add bz2 (bzip2) as a valid download file compression algorithm (#1655)
* feat(vm): Allow bz2 (bzip2) as a valid compression algorithm (pve >= 8.3)

Signed-off-by: Qlem <qlem@qlem.net>
2024-11-24 13:41:58 -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
23859750b1
fix(provider): "context deadline exceeded" error when retrieving the next available VM identifier (#1647)
* fix(provider): "context deadline exceeded" error when retrieving the next available VM identifier

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-11-20 23:02:03 -05:00
Mrton0121
8b51e9991e
feat(cpu type): CPU type support for EPYC-v4 (#1611) 2024-11-04 08:29:19 -05:00
dgriswo
0ba36e48da
fix(cluster): insecure migration_type validation (#1607)
fix(provider): fix insecure migration_type validation

Signed-off-by: dgriswo <daniel@griswoldcomputing.com>
2024-11-03 15:48:53 -05:00
Pavel Boldyrev
e838c6b645
fix(provider): sequentially generated vm_ids may clash with exiting… (#1574)
fix(provider): sequentially generated `vm_id`s may clash with exiting VM / Container IDs

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-10-04 20:41:23 -04:00
Pavel Boldyrev
72f7cb81a8
feat(provider): reliable sequential and random vm_id generation (#1557)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-10-03 20:18:37 -04:00
vanillaSprinkles
eb2f36be21
feat(provider): add support for pre(external) auth'd session tokens (#1441)
* feat(provider): add support for pre(external) auth'd session tokens

adds provider config inputs:
  - env vars: PROXMOX_VE_AUTH_PAYLOAD; PROXMOX_VE_AUTH_TICKET with PROXMOX_VE_CSRF_PREVENTION_TOKEN
  - provider-config: auth_payload; auth_ticket with csrf_prevention_token

Signed-off-by: vanillaSprinkles <vanillaSprinkles@users.noreply.github.com>

* add //nolint to "todo" comments/questions and lll for build to pass; add flags to terraform-plugin-docs

Signed-off-by: vanillaSprinkles <vanillaSprinkles@users.noreply.github.com>

* address first iteration of comments: remove auth-payload, improve index.md

Signed-off-by: vanillaSprinkles <vanillaSprinkles@users.noreply.github.com>

* refactor credentials using struct composition, other minor cleanups

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

* fix linter error

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

* fix make docs, add terraform to handle fmt

Signed-off-by: vanillaSprinkles <vanillaSprinkles@users.noreply.github.com>

---------

Signed-off-by: vanillaSprinkles <vanillaSprinkles@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-10-02 20:40:33 -04: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
89d72cd37f
fix(lxc): add new storage-backed mount point to existing container (#1553)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-23 21:47:43 -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
Pavel Boldyrev
44e2814adf
fix(file): respect download_file.override attr when checking for th… (#1537)
fix(file): respect `download_file.override` attr when checking for the file size change during update

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-16 22:02:25 +00:00
Pavel Boldyrev
f4ee6291cc
feat(vm): remove deprecated vga.enabled (#1533)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-11 22:20:29 +00:00
renovate[bot]
356c978ece
chore(deps): update module github.com/golangci/golangci-lint (v1.60.3 → v1.61.0) in /tools (#1527)
* chore(deps): update module github.com/golangci/golangci-lint (v1.60.3 → v1.61.0) in /tools

| datasource | package                           | from    | to      |
| ---------- | --------------------------------- | ------- | ------- |
| go         | github.com/golangci/golangci-lint | v1.60.3 | v1.61.0 |

* disable gosec: G115 linter

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-09-09 20:55:46 -04:00
Pavel Boldyrev
35b6571bf4
chore(vm): add acc test for no cdrom by default (#1523)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-08 22:14:16 +00:00
Björn Brauer
a6eb81af08
feat(acme): implement resources and data sources for ACME plugins (#1479)
* feat(acme): implement CRUD API for proxmox cluster ACME plugins

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

* feat(acme): implement acme_plugins data source

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

* feat(acme): implement acme_plugin data source

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

* feat(acme): implement plugin resource creation

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

* feat(acme): implement plugin resource read

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

* feat(acme): implement plugin resource update

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

* feat(acme): implement plugin resource deletion

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

* feat(acme): implement plugin resource import

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

* docs(acme): generate documentation

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

* fix: apply suggestions from code review

Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Signed-off-by: Björn Brauer <zaubernerd@zaubernerd.de>

* refactor: extract common fields into BasePluginData

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

* fix: restrict plugin resource to type=dns only

because type=standalone is not configurable and always enabled by
default.

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

* fix: remove unused 'nodes' property

https://github.com/bpg/terraform-provider-proxmox/pull/1479/files#r1710916265

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

* fix: remove "delete" property

https://github.com/bpg/terraform-provider-proxmox/pull/1479/files#r1710908809

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

* feat: implement attribute deletion

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

* fix: ignore empty lines in dns plugin data

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

* fix: partial revert of code review suggestions

Joining the values with a string literal would produce \\n instead of \n
and splitting at \\n doesn't match a newline.

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

* refactor: extract acme plugin models into separate file

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

* fix: format disable parameter as int

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

---------

Signed-off-by: Björn Brauer <zaubernerd@zaubernerd.de>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-09-08 10:54:16 -04:00
renovate[bot]
35cbe98d6b
chore(deps): update module github.com/golangci/golangci-lint (v1.60.1 → v1.60.2) in /tools (#1499)
* chore(deps): update module github.com/golangci/golangci-lint (v1.60.1 → v1.60.2) in /tools

| datasource | package                           | from    | to      |
| ---------- | --------------------------------- | ------- | ------- |
| go         | github.com/golangci/golangci-lint | v1.60.1 | v1.60.2 |

* fix linter errors

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-22 00:30:20 +00: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
Pavel Boldyrev
8f82d1a384
chore(code): align resource/datasource names in the fwprovider code (#1488)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-08-13 01:03:17 +00:00
Björn Brauer
9de4037a82
feat(acme): implement resources and data sources for ACME accounts (#1455)
* feat(acme): implement CRUD API for proxmox cluster ACME
* feat(acme): implement acme_accounts data source
* feat(acme): implement acme_account data source
* fix(acme): wait for task status on account creation
* feat(acme): implement account resource creation
* feat(acme): implement account read
* fix(acme): wait for task status on account update
* feat(acme): implement account update
* fix(acme): wait for task status on account deletion
* feat(acme): implement account deletion
* feat(acme): implement account import
* feat(acme): provide correctly typed API response for `account` field
* feat(acme): implement account schema for acme_account data source
* fix(acme): read `location` into state in acme_account resource
* fix(acme): ensure `name` of acme_account resource can't be changed
* docs(acme): generate documentation
* feat(acme): read back ACME account details from API
* Revert "fix(acme): ensure `name` of acme_account resource can't be changed"
* fix(acme): provide default for acme account name
* fix(acme): acme account name can't be changed
* chore(acme): update resource doc to clarify PVE auth requirements
* chore(acme): add `created_at` attr to the resource, sort model fields & schema attributes alphabetically

---------

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-08-07 23:16:31 -04:00
Pavel Boldyrev
b4d4e4f9d4
fix(time): embed timezone data to fix set/get TZ on windows (#1436)
* fix(time): embed timezone data to fix set/get TZ on windows

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-10 21:07:40 -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
Pavel Boldyrev
6103e67ae9
fix(repo): fix source.list path validation on Windows (#1429)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-07-05 20:20:34 -04: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
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
a0d9300f0f
chore: refactor container acc test (#1408)
+ beautify test output on CI

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-24 23:08:59 -04:00
Pavel Boldyrev
4a8bf8da27
fix(lxc): use default rootfs size (4Gb) prevents creation of mount points (#1398)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-17 03:47:50 +00: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
994f367cc2
feat(vm): allow none cdrom (#1347)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-06-03 01:24:06 +00:00
Pavel Boldyrev
d02dc1eb0a
fix(vm): adding disks causes VM to be re-created (#1336)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-29 23:12:05 -04:00
Pavel Boldyrev
2785c40d44
fix(vm): regression: vga.clipboard attribute check (#1340)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-30 01:36:47 +00: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
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
e3dd31f55e
chore(vm2): add datasource implementation (#1318)
* chore(vm2): add datasource implementation

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-22 02:06:41 +00:00
Pavel Boldyrev
2e34c57f6c
chore(vm2): cleanup cpu implementation, refactor rearrange acc tests (#1311)
* chore(vm2): cleanup `cpu` implementation, refactor rearrange acc tests

---------

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-18 23:31:50 -04: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
3180f81b4a
fix(vm): yet another fix for disk reordering (#1297)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-15 02:31:41 +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
a436c24923
fix(access): user token expiration_date handling (#1293)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-14 18:24:13 -04:00
Pavel Boldyrev
be4a3b7c6f
fix(vm): cdrom is not attached when creating a VM from scratch (#1287)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-13 02:08:44 +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
Pavel Boldyrev
c6019aa432
fix(access): change acl internal ID from url path format to position-based format (#1282)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-10 03:53:16 +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
Serge
8220271eee
feat(access): add proxmox user token (#1159) 2024-05-08 15:26:33 -04:00
Pavel Boldyrev
0b35f47780
fix(code): update acc tests to PVE 8.2 (#1269)
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-06 23:50:11 +00:00
Kai
97624052f1
fix(vm): only set initialization.upgrade attribute when not using custom cloud-init file (#1253)
* fix: ignore upgrade parameter when custom cloud-init file is used

Signed-off-by: Kai <nankeen@users.noreply.github.com>

* fix acceptance tests, make `upgrade` computed

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

---------

Signed-off-by: Kai <nankeen@users.noreply.github.com>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Kai <nankeen@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
2024-05-06 19:16:14 -04:00