terraform-provider-incus provided only subset of /1.0/instances/{name}/files functionality. It allows only to upload regular files and update owners and permissions.
Incus API provides additional functionality:
manipulate with directoriesand symlinkfiles
support file deletion
Proposal
To extend file block configuration in incus_instance resource with attributes:
directory, manipulates with the single directory. Additional validation:contentattribute must benull`
symlink, manipulates with the symlink file. Additional validation: content attribute must be one-line string.
operation (optional) with values:
override (default), creates new file, symlink, or directory if it not exists; overrides content of regular file or changes link target for symlink if it exists; keeps existing directory if it exists.
append, appends content of file if it's exists. Probably additional discussion about how to handle symlink, directory or non-exist file is needed .
Problem
terraform-provider-incus
provided only subset of/1.0/instances/{name}/files
functionality. It allows only to upload regular files and update owners and permissions. Incus API provides additional functionality:directories
andsymlink
filesProposal
To extend
file
block configuration inincus_instance
resource with attributes:type
(optional) with values:file
(default), covers already implemented functionalitydirectory, manipulates with the single directory. Additional validation:
contentattribute must be
null`symlink
, manipulates with thesymlink
file. Additional validation:content
attribute must be one-line string.override
(default), creates newfile
,symlink
, ordirectory
if it not exists; overrides content of regularfile
or changes link target forsymlink
if it exists; keeps existing directory if it exists.append
, appends content of file if it's exists. Probably additional discussion about how to handlesymlink
,directory
or non-exist file is needed .