Ability to overwrite Terraform module
Related to #348690.
It would be good to be able to overwrite Terraform modules.
Currently we're trying to upload a terraform module for each feature branch which means we want to have a module with a version such as 0.0.0-feature-branch-name
. This module would then be overwritten for every commit to that branch.
Obsolete information
Currently, the recommended way to do this is to first manually delete the module and then re-upload it, but this is easier said than done as explained in #348690 because it seems that the GET endpoint for retrieving terraform modules isn't returning anything.UPDATE: it is possible to GET the Terraform packages by providing the correct package_type
. This was unclear from the documentation but that is now being fixed to some extent at least.
But even if that endpoint was working, it is a complicated procedure to have to first check whether the module exists, then get its current ID, then delete it and finally re-upload it. Instead, it would be better to be able to just upload the module with a flag such as overwrite=true
and be done with it.
UPDATE: this is especially complicated when pagination needs to be taken into account. The ability to filter on package version is not currently supported but I've created an issue requesting that as well.
There might be some specific reason for why this is not supported that I don't know about. It seems unlikely though since deleting a module is supported.
So I ask you to consider enabling this.