jfrog/terraform-provider-artifactory

Allow uploading files to a repo

Closed this issue · 2 comments

Is your feature request related to a problem? Please describe.
I would like a way to upload a file to a generic repo or a maven repo using Terraform.
The file contents can be the output from another terraform resource in json format.

Describe the solution you'd like
A resource named artifactory_file or similar with parameters for the repo name, and the file contents.
The file contents can be read from a file on disk or provided as a string or base64 encoded binary data for example.

Describe alternatives you've considered
I'll have to use a null resource since this is not available currently.

Additional context
I don't want to put this in AWS parameter store or secrets manager.

@DavidGamba Thank you for the suggestion. However, this does not match well with the Terraform resource concept. File upload can potentially be the 'create' part of the a artifactory_file resource. 'Update' can be potentially a force recreation? 'Delete' will just be deleting an artifact item. 'Read' is the tricky one because is downloading a file what you wish to do? I don't know for sure at this moment.

I would probably store the hash of the file rather than the file contents in state, so read would be querying for the hash to compare against the locally generated hash to see if there is need for an update.
Update would definitely need to overwrite the file because the expectation from the user would be to have the file match exactly what you have locally.
We already have the data blocks that allow to pull the contents of the file. There are many examples of resources that don't provide the contents you upload to build the resource as an attribute and where the contents are only accessible as a separate data resource.