Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e330438
feat(core): add support for interacting with the `/storage` endpoint
jmsnll Aug 17, 2025
0a8067e
feat(core): implement resource for creating directory storage types
jmsnll Aug 18, 2025
5314b34
fix(core): file upload to use new storage structs & interface
jmsnll Aug 18, 2025
14d6014
refactor(storage): introduce schema factory for adding new storage re…
jmsnll Aug 18, 2025
71ada4b
refactor(storage): split out types into base & storage specific files
jmsnll Aug 18, 2025
599112a
refactor(storage): remove type from schema as it's implied by each re…
jmsnll Aug 18, 2025
6b158ef
fix(storage): defaults for nodes and content fields after move
jmsnll Aug 18, 2025
7bd1ffa
fix(storage): make shared no longer a common immutable field, not sup…
jmsnll Aug 18, 2025
f15fd7d
refactor(storage): remove unused supported type variable
jmsnll Aug 18, 2025
261c4dc
feat(storage): implement generic resource and add NFS support
jmsnll Aug 18, 2025
d5a76c9
refactor(storage): update directory resource to use generic resource
jmsnll Aug 18, 2025
ca4b528
refactor(storage): introduce a base storage model to handle setting c…
jmsnll Aug 18, 2025
9087a3e
feat(storage): add Proxmox Backup Server support
jmsnll Aug 18, 2025
4d2ec08
feat(storage): add ZFS pool support
jmsnll Aug 18, 2025
b10b62a
feat(storage): add LVM support
jmsnll Aug 19, 2025
e9c8693
feat(storage): add LVM thin support
jmsnll Aug 19, 2025
2cd3461
refactor(storage): remove schema factory options variadic
jmsnll Aug 22, 2025
9025a70
fix(storage): add missing shared fields to lvm resources
jmsnll Aug 22, 2025
ebd353a
feat(storage): integrate backup's block
jmsnll Aug 23, 2025
747a708
test(storage): test prune backups string representation
jmsnll Aug 23, 2025
57c6090
docs(storage): remove irrelevant docstring
jmsnll Aug 23, 2025
a9d1250
feat(storage): add support for SMB/CIFS shares
jmsnll Aug 23, 2025
b3a396a
test(storage): remove irrelevant JSON Marshalling tests for backups b…
jmsnll Aug 23, 2025
6c23a8e
fix: linter errors
bpg Aug 27, 2025
30da718
Merge remote-tracking branch 'origin/main' into feat/support-cluster-…
bpg Aug 27, 2025
8e3bc8c
Merge branch 'main' into feat/support-cluster-storage
bpg Aug 27, 2025
212b174
feat: add docs
bpg Aug 28, 2025
21c8ac4
Merge branch 'feat/support-cluster-storage' of github.com:jmsnll/terr…
bpg Aug 28, 2025
b8c19f6
Merge branch 'main' into feat/support-cluster-storage
bpg Aug 31, 2025
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
45 changes: 45 additions & 0 deletions docs/resources/virtual_environment_storage_directory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
layout: page
title: proxmox_virtual_environment_storage_directory
parent: Resources
subcategory: Virtual Environment
description: |-
Manages directory-based storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_directory

Manages directory-based storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique identifier of the storage.
- `path` (String) The path to the directory on the Proxmox node.

### Optional

- `backups` (Block, Optional) Configure backup retention settings for the storage type. (see [below for nested schema](#nestedblock--backups))
- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `preallocation` (String) The preallocation mode for raw and qcow2 images.
- `shared` (Boolean) Whether the storage is shared across all nodes.

<a id="nestedblock--backups"></a>
### Nested Schema for `backups`

Optional:

- `keep_all` (Boolean) Specifies if all backups should be kept, regardless of their age.
- `keep_daily` (Number) The number of daily backups to keep. Older backups will be removed.
- `keep_hourly` (Number) The number of hourly backups to keep. Older backups will be removed.
- `keep_last` (Number) Specifies the number of the most recent backups to keep, regardless of their age.
- `keep_monthly` (Number) The number of monthly backups to keep. Older backups will be removed.
- `keep_weekly` (Number) The number of weekly backups to keep. Older backups will be removed.
- `keep_yearly` (Number) The number of yearly backups to keep. Older backups will be removed.
- `max_protected_backups` (Number) The maximum number of protected backups per guest. Use '-1' for unlimited.
30 changes: 30 additions & 0 deletions docs/resources/virtual_environment_storage_lvm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
layout: page
title: proxmox_virtual_environment_storage_lvm
parent: Resources
subcategory: Virtual Environment
description: |-
Manages LVM-based storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_lvm

Manages LVM-based storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique identifier of the storage.
- `volume_group` (String) The name of the volume group to use.

### Optional

- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `shared` (Boolean) Whether the storage is shared across all nodes.
- `wipe_removed_volumes` (Boolean) Whether to zero-out data when removing LVMs.
30 changes: 30 additions & 0 deletions docs/resources/virtual_environment_storage_lvmthin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
layout: page
title: proxmox_virtual_environment_storage_lvmthin
parent: Resources
subcategory: Virtual Environment
description: |-
Manages thin LVM-based storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_lvmthin

Manages thin LVM-based storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique identifier of the storage.
- `thin_pool` (String) The name of the LVM thin pool to use.
- `volume_group` (String) The name of the volume group to use.

### Optional

- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `shared` (Boolean) Whether the storage is shared across all nodes.
36 changes: 36 additions & 0 deletions docs/resources/virtual_environment_storage_nfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: page
title: proxmox_virtual_environment_storage_nfs
parent: Resources
subcategory: Virtual Environment
description: |-
Manages an NFS-based storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_nfs

Manages an NFS-based storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `export` (String) The path of the NFS export.
- `id` (String) The unique identifier of the storage.
- `server` (String) The IP address or DNS name of the NFS server.

### Optional

- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `options` (String) The options to pass to the NFS service.
- `preallocation` (String) The preallocation mode for raw and qcow2 images.
- `snapshot_as_volume_chain` (Boolean) Enable support for creating snapshots through volume backing-chains.

### Read-Only

- `shared` (Boolean) Whether the storage is shared across all nodes.
41 changes: 41 additions & 0 deletions docs/resources/virtual_environment_storage_pbs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: page
title: proxmox_virtual_environment_storage_pbs
parent: Resources
subcategory: Virtual Environment
description: |-
Manages a Proxmox Backup Server (PBS) storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_pbs

Manages a Proxmox Backup Server (PBS) storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `datastore` (String) The name of the datastore on the Proxmox Backup Server.
- `id` (String) The unique identifier of the storage.
- `password` (String, Sensitive) The password for authenticating with the Proxmox Backup Server.
- `server` (String) The IP address or DNS name of the Proxmox Backup Server.
- `username` (String) The username for authenticating with the Proxmox Backup Server.

### Optional

- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `encryption_key` (String, Sensitive) An existing encryption key for the datastore. This is a sensitive value. Conflicts with `generate_encryption_key`.
- `fingerprint` (String) The SHA256 fingerprint of the Proxmox Backup Server's certificate.
- `generate_encryption_key` (Boolean) If set to true, Proxmox will generate a new encryption key. The key will be stored in the `generated_encryption_key` attribute. Conflicts with `encryption_key`.
- `namespace` (String) The namespace to use on the Proxmox Backup Server.
- `nodes` (Set of String) A list of nodes where this storage is available.

### Read-Only

- `encryption_key_fingerprint` (String) The SHA256 fingerprint of the encryption key currently in use.
- `generated_encryption_key` (String, Sensitive) The encryption key returned by Proxmox when `generate_encryption_key` is true.
- `shared` (Boolean) Whether the storage is shared across all nodes.
39 changes: 39 additions & 0 deletions docs/resources/virtual_environment_storage_smb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
layout: page
title: proxmox_virtual_environment_storage_smb
parent: Resources
subcategory: Virtual Environment
description: |-
Manages an SMB/CIFS based storage server in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_smb

Manages an SMB/CIFS based storage server in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique identifier of the storage.
- `password` (String, Sensitive) The password for authenticating with the SMB/CIFS server.
- `server` (String) The IP address or DNS name of the SMB/CIFS server.
- `share` (String) The name of the SMB/CIFS share.
- `username` (String) The username for authenticating with the SMB/CIFS server.

### Optional

- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `domain` (String) The SMB/CIFS domain.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `preallocation` (String) The preallocation mode for raw and qcow2 images.
- `snapshot_as_volume_chain` (Boolean) Enable support for creating snapshots through volume backing-chains.
- `subdirectory` (String) A subdirectory to mount within the share.

### Read-Only

- `shared` (Boolean) Whether the storage is shared across all nodes.
34 changes: 34 additions & 0 deletions docs/resources/virtual_environment_storage_zfspool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
layout: page
title: proxmox_virtual_environment_storage_zfspool
parent: Resources
subcategory: Virtual Environment
description: |-
Manages ZFS-based storage in Proxmox VE.
---

# Resource: proxmox_virtual_environment_storage_zfspool

Manages ZFS-based storage in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique identifier of the storage.
- `zfs_pool` (String) The name of the ZFS storage pool to use (e.g. `tank`, `rpool/data`).

### Optional

- `blocksize` (String) Block size for newly created volumes (e.g. `4k`, `8k`, `16k`). Larger values may improve throughput for large I/O, while smaller values optimize space efficiency.
- `content` (Set of String) The content types that can be stored on this storage.
- `disable` (Boolean) Whether the storage is disabled.
- `nodes` (Set of String) A list of nodes where this storage is available.
- `thin_provision` (Boolean) Whether to enable thin provisioning (`on` or `off`). Thin provisioning allows flexible disk allocation without pre-allocating full space.

### Read-Only

- `shared` (Boolean) Whether the storage is shared across all nodes.
10 changes: 9 additions & 1 deletion fwprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"github.com/bpg/terraform-provider-proxmox/fwprovider/nodes/datastores"
"github.com/bpg/terraform-provider-proxmox/fwprovider/nodes/network"
"github.com/bpg/terraform-provider-proxmox/fwprovider/nodes/vm"
"github.com/bpg/terraform-provider-proxmox/fwprovider/storage"
"github.com/bpg/terraform-provider-proxmox/proxmox"
"github.com/bpg/terraform-provider-proxmox/proxmox/api"
"github.com/bpg/terraform-provider-proxmox/proxmox/cluster"
Expand Down Expand Up @@ -534,7 +535,14 @@
sdnzone.NewQinQResource,
sdnzone.NewVXLANResource,
sdnzone.NewEVPNResource,
sdnapplier.NewResource,
sdnapplier.NewResource,

Check failure on line 538 in fwprovider/provider.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not properly formatted (gofmt)
storage.NewDirectoryStorageResource,
storage.NewLVMPoolStorageResource,
storage.NewLVMThinPoolStorageResource,
storage.NewNFSStorageResource,
storage.NewProxmoxBackupServerStorageResource,
storage.NewCIFSStorageResource,
storage.NewZFSPoolStorageResource,
}
}

Expand Down
23 changes: 23 additions & 0 deletions fwprovider/storage/model_backups.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/

package storage

import (
"github.com/hashicorp/terraform-plugin-framework/types"
)

// BackupModel maps the backup block schema.
type BackupModel struct {
MaxProtectedBackups types.Int64 `tfsdk:"max_protected_backups"`
KeepAll types.Bool `tfsdk:"keep_all"`
KeepLast types.Int64 `tfsdk:"keep_last"`
KeepHourly types.Int64 `tfsdk:"keep_hourly"`
KeepDaily types.Int64 `tfsdk:"keep_daily"`
KeepWeekly types.Int64 `tfsdk:"keep_weekly"`
KeepMonthly types.Int64 `tfsdk:"keep_monthly"`
KeepYearly types.Int64 `tfsdk:"keep_yearly"`
}
Loading
Loading