-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description:
When using the bpg/proxmox Terraform provider to upload snippets, ISOs, or other content to an S3-backed storage, the operation fails during resource creation.
The provider uploads the file successfully, then immediately tries to read it back to populate Terraform state. At that point, proxs3 hasn't finished processing the upload (fsnotify watcher uses a 3-second debounce before triggering the S3 upload and metadata indexing), so the read-back fails with:
Error: failed to read file from "s3-iso:snippets/cloud-config-ubuntu.yaml"
This affects all content types managed through the provider — snippets, ISOs, and likely any other proxmox_virtual_environment_file resource.
Reproduction
resource "proxmox_virtual_environment_file" "snippet" {
node_name = "pve"
content_type = "snippets"
datastore_id = "s3-iso"
source_raw {
data = "..."
file_name = "cloud-config-ubuntu.yaml"
}
}terraform apply → upload succeeds → immediate read-back fails because the file isn't indexed yet.
Root cause
The file watcher pipeline introduces a delay between a file landing in the cache directory and it becoming visible via the /v1/list or /v1/download endpoints. The bpg/proxmox provider expects the file to be queryable immediately after the PVE API upload call returns.
Possible solutions
- Detect writes to the cache directory synchronously during an active PVE API upload (bypass the debounce for files written through the Proxmox storage API path)
- Register uploaded files in metadata immediately on write, before the S3 upload completes
- Expose an option to make the upload path synchronous — wait for the S3 upload to finish before returning from the PVE API call