terraform-provider-incus icon indicating copy to clipboard operation
terraform-provider-incus copied to clipboard

Extend file block functionality in the instance resource to provide more granular control

Open tregubovav-dev opened this issue 8 months ago • 0 comments

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 directories and symlink files
  • support file deletion

Proposal

To extend file block configuration in incus_instance resource with attributes:

  • type (optional) with values:
    • file (default), covers already implemented functionality
    • 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 .

tregubovav-dev avatar Jun 26 '24 21:06 tregubovav-dev