terraform-provider-incus
terraform-provider-incus copied to clipboard
Extend file block functionality in the instance resource to provide more granular control
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:
- manipulate with
directoriesandsymlinkfiles - support file deletion
Proposal
To extend file block configuration in incus_instance resource with attributes:
type(optional) with values:file(default), covers already implemented functionalitydirectory, manipulates with the single directory. Additional validation:contentattribute must benull`symlink, manipulates with thesymlinkfile. Additional validation:contentattribute must be one-line string.
- operation (optional) with values:
override(default), creates newfile,symlink, ordirectoryif it not exists; overrides content of regularfileor changes link target forsymlinkif it exists; keeps existing directory if it exists.append, appends content of file if it's exists. Probably additional discussion about how to handlesymlink,directoryor non-exist file is needed .
When creating a new instance often it's useful to specify configuration files before boot. It would be nice to have a way of specifying if the file should be inserted into the instance before it first boots or after.