* chore(tests): add option to select auth type (root user / token) for tests
* fix(vm): throw an error when `cpu.architecture` can't be set
---------
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
* 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>
Regression after #1580, the provider incorrectly detects that disk has been resized when other disk attributes change.
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Fix for another use case of mismanaged default value. This one was a bit trickier to spot as it triggered only when provider is authenticated using root@pam, as architecture change is allowed only for root.
Removing default value altogether, as the PVE API default for this attribute is an empty string.
VM2 resource will have no such issue, related: #1310, #1311
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
* feat(lxc): Implement support for container's "protection flag"
The Proxmox VE types already has the `protection` API parameter [1],
but it is not exposed to the provider users.
This pull request implements the missing logic to make it available in
order to allow to protect containers against deletion/update operations,
including the container's disks.
[1]: https://github.com/bpg/terraform-provider-proxmox/blob/v0.63.0/proxmox/nodes/containers/containers_types.go#L59
Relates GH-1126
Signed-off-by: Sven Greb <development@svengreb.de>
* Update example/resource_virtual_environment_container.tf
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
---------
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>
* feat(file): Add support to set the file mode
GH-733 [1] implemented basic support for hook scripts, but the authors
"did not manage to find time to work on" [2] also including support to
set the file mode. This small but important feature makes the use of the
`proxmox_virtual_environment_container.hook_script_file_id` [3] and
`virtual_environment_vm.hook_script_file_id` [34] attributes basically
useless when not combined with the manual step of making the uploaded
file executable (manually running `chmod +x /path/to/script` or using
other methods, based on the storage backend). Using the
`hook_script_file_id` on its own also causes all planned and applies
changes in the same execution to not be saved in the state because the
Proxmox VE API responses with a HTTP `500` because the uploaded and
assigned file is not executable.
This pull request implements the missing feature to set the file mode
by adding a new `file_mode` attribute of type `string` where an
octal-formatted value can be passed, e.g. `0700` or only `600`.
Note that the support for the octal prefixes `0o` and `0x` are not
supported to reduced the complexity, even though Go of course support
it, including the used `os.FileMode` type [5].
Changing the file mode also causes the file to be replaced, which is
true for almost any attribute in the `proxmox_virtual_environment_file`
resource, to ensure that the file mode can also be changed after the
initial creation.
[1]: https://github.com/bpg/terraform-provider-proxmox/pull/733
[2]: https://github.com/bpg/terraform-provider-proxmox/pull/733#issuecomment-2096716738
[3]: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_container#hook_script_file_id
[4]: https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_vm#hook_script_file_id
[5]: https://pkg.go.dev/os#FileMode
Related to GH-570
Related to GH-733
Signed-off-by: Sven Greb <development@svengreb.de>
---------
Signed-off-by: Sven Greb <development@svengreb.de>
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>
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>
* 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>
* 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>
* feat(vm): add initial support for IDE
Very broken, doesn't properly work at the moment, WIP
Signed-off-by: DevMiner <devminer@devminer.xyz>
* add acceptance test for ide disks, fixed few issues
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
* update VM example
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
---------
Signed-off-by: DevMiner <devminer@devminer.xyz>
Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>