-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proxmox_virtual_environment_file with content_type=snippets and source_file does not work #370
Comments
I've been banging my head for a week trying to work around this, I thought I had just something configured wrong! |
Discovered that content type "iso" actually supports for ".img" files, so the following works:
Btw. the |
Also came across this issue as well yesterday. Use case was to use one of these files for the user_data in cloud-init Workaround was to use source_raw rather than source_file and then use file() to put the data in BTW: Cool provider :) |
Indeed, it was due to missing "Snippets" content type on the storage. I've added a better diagnostic for this use case:
|
@bpg I have seen you last comment here and wondered why I did not see the message Without enabling "snippets" it showed this message:
Interestingly after disabling it again (after applying a snippet successfully) and reapplying it the message posted by you shows up. |
@DanielHabenicht Yes, please open the issue. Missing warning could be related to auth / permissions, we need to investigate this a bit further. |
Describe the bug
Using
proxmox_virtual_environment_file
resource with non-empty attributesource_file
andcontent_type=snippets
fails with:To Reproduce
Steps to reproduce the behavior:
main.tf
file with following contents:terraform-provider-proxmox/proxmoxtf/resource/file.go
Line 627 in 926382c
Observed behavior
Function
fileCreate
has special path forsnippets
and uses SSH for upload, but at the end it callsfileRead
,which assumes that just uploaded file will be available using PVE API result, which is not true for
content_type=snippets
.Loop matches nothing, and at the end of the function
d.SetId("")
is called, causing the error.Commenting out
d.SetId("")
works around the problem. But it is NOT a fix! For resources (files) deleted by other means (e.g. SSH, or just two copies of colliding terraform environments using same names), terraform would not know about that, and believe that they still exist.Proper fix likely requires
fileRead
to check existence of the file using SSH.Additional context
Really not sure about the logic of
fileRead
itself, it looks like it needs to be rewritten.Following behavior is suspect:
It seems to ignore everything from PVE API except the
v.VolumeID
.Looks like it would not detect .img or .iso file in the datastore being replaced by one with same name but different size, because returned
DatastoreFileListResponseData.FileSize
is not even accessed.It probably should at least call something like
d.Set(mkResourceVirtualEnvironmentFileFileSize, v.FileSize)
.When file resource is using
source_raw
(i.e. no source file), it bails early:terraform-provider-proxmox/proxmoxtf/resource/file.go
Line 564 in 926382c
The text was updated successfully, but these errors were encountered: