Skip to content

Commit

Permalink
feat(cluster): Implement "next-id" and "notify" PVE API cluster options
Browse files Browse the repository at this point in the history
This commit implements the `next-id` and `notify` PVE API cluster
options.

The `next-id` attribute allows to control the range for the next free
VM ID. It is implemented as object and can be used in the
`proxmox_virtual_environment_cluster_options` resource and can be used
like this:

```terraform
resource "proxmox_virtual_environment_cluster_options" "options" {
  next_id = {
    lower = 200
    upper = 299
  }
}
```

Note that the minimum and maximum values are unfortunately not
documented in the PVE API explorer but can be found in the web UI where
the form fields have validations!

The `notify` PVE API attribute is also an object that has all the PVE
API fields:

```terraform
resource "proxmox_virtual_environment_cluster_options" "options" {
  notify = {
    ha_fencing_mode            = "never"
    ha_fencing_target          = "default-matcher"
    package_updates            = "always"
    package_updates_target     = "default-matcher"
    package_replication        = "always"
    package_replication_target = "default-matcher"
  }
}
```terraform

Note that the "fencing" attribute names have been adjusted to better
reflect their meaning since they are scoped to the Proxmox VE HA fencing
feature [1]. All attributes with the `_target` suffix are names for the
Proxmox VE notifications matchers [2].

[1]: https://pve.proxmox.com/wiki/Fencing
[2]: https://pve.proxmox.com/pve-docs/chapter-notifications.html#notification_matchers

Signed-off-by: Sven Greb <[email protected]>
  • Loading branch information
svengreb committed Apr 27, 2024
1 parent 0839c92 commit 908b9a7
Show file tree
Hide file tree
Showing 5 changed files with 415 additions and 58 deletions.
35 changes: 35 additions & 0 deletions docs/resources/virtual_environment_cluster_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ resource "proxmox_virtual_environment_cluster_options" "options" {
max_workers = 5
migration_cidr = "10.0.0.0/8"
migration_type = "secure"
next_id = {
lower = 100
upper = 999999999
}
notify = {
ha_fencing_mode = "never"
ha_fencing_target = "default-matcher"
package_updates = "always"
package_updates_target = "default-matcher"
package_replication = "always"
package_replication_target = "default-matcher"
}
}
```

Expand All @@ -49,11 +61,34 @@ resource "proxmox_virtual_environment_cluster_options" "options" {
- `max_workers` (Number) Defines how many workers (per node) are maximal started on actions like 'stopall VMs' or task from the ha-manager.
- `migration_cidr` (String) Cluster wide migration network CIDR.
- `migration_type` (String) Cluster wide migration type. Must be `secure` | `unsecure` (default is `secure`).
- `next_id` (Attributes) The ranges for the next free VM ID auto-selection pool. (see [below for nested schema](#nestedatt--next_id))
- `notify` (Attributes) Cluster-wide notification settings. (see [below for nested schema](#nestedatt--notify))

### Read-Only

- `id` (String) The unique identifier of this resource.

<a id="nestedatt--next_id"></a>
### Nested Schema for `next_id`

Optional:

- `lower` (Number) The minimum number for the next free VM ID. Must be higher or equal to 100
- `upper` (Number) The maximum number for the next free VM ID. Must be less or equal to 999999999


<a id="nestedatt--notify"></a>
### Nested Schema for `notify`

Optional:

- `ha_fencing_mode` (String) Cluster-wide notification settings for the HA fencing mode. Must be `always` | `never`.
- `ha_fencing_target` (String) Cluster-wide notification settings for the HA fencing target.
- `package_updates` (String) Cluster-wide notification settings for package updates. Must be `auto` | `always` | `never`.
- `package_updates_target` (String) Cluster-wide notification settings for the package updates target.
- `replication` (String) Cluster-wide notification settings for replication. Must be `always` | `never`.
- `replication_target` (String) Cluster-wide notification settings for the replication target.

## Import

Import is supported using the following syntax:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,16 @@ resource "proxmox_virtual_environment_cluster_options" "options" {
max_workers = 5
migration_cidr = "10.0.0.0/8"
migration_type = "secure"
next_id = {
lower = 100
upper = 999999999
}
notify = {
ha_fencing_mode = "never"
ha_fencing_target = "default-matcher"
package_updates = "always"
package_updates_target = "default-matcher"
package_replication = "always"
package_replication_target = "default-matcher"
}
}
Loading

0 comments on commit 908b9a7

Please sign in to comment.