bpg / terraform-provider-proxmox

Terraform Provider for Proxmox
https://registry.terraform.io/providers/bpg/proxmox
Mozilla Public License 2.0
858 stars 137 forks source link

Loading file from backup #1617

Closed EugenMayer closed 2 days ago

EugenMayer commented 1 week ago

env:

The following definition fow a proxmox_virtual_environment_file

resource "proxmox_virtual_environment_file" "dummy_backup" {
  content_type = "dump"
  datastore_id = "remote-backup"
  node_name    = "proxmox"

  source_file {
    path = "vzdump-qemu-999-2024_11_02-12_29_42.vma"
  }
}

this is the filename

ls -la /mnt/pve/remote-backup/dump | grep 999 | grep vma
-rwxrwxrwx 1 root root   3447566848 Nov  2 12:30 vzdump-qemu-999-2024_11_02-12_29_42.vm

the storage config

image

When applying the resource, i get

│ Error: open vzdump-qemu-999-2024_11_02-12_29_42.vma: no such file or directory
│ 
│   with proxmox_virtual_environment_file.dummy_backup,
│   on test.tf line 8, in resource "proxmox_virtual_environment_file" "dummy_backup":
│    8: resource "proxmox_virtual_environment_file" "dummy_backup" {

Anything i misunderstood in this regard? Used https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_file#backups-dump as my guide

Thanks

bpg commented 1 week ago

Hey @EugenMayer 👋🏼

I’m not entirely clear on the use case, are you trying to download a backup file from PVE to your local machine, or upload a backup file to PVE?

The doc you referenced is indeed a bit sparse and may not be very helpful. We can definitely work on improving it to make it more useful.

EugenMayer commented 1 week ago

Hey @bpg

the backup is located on a mounted NFS volume, you might be able to see it in the screenshot. For promox, this is just a common backup from a local folder, see the shell output i provided ( the ls ).

My goal is to restore a disk from a backup

bpg commented 1 week ago

Well, the proxmox_virtual_environment_file resource allows you to "create" a file in PVE, which in this context means uploading a backup file to PVE storage. Which might not be particularly useful in your use case.

The provider does not support restore from a backup at the moment.

EugenMayer commented 1 week ago

Sorry, i assume i simply misunderstood this then. May i close the ticket?