Skip to main content

Cleanup / GC of unused and deleted module versions from S3

Currently when you hit the delete button on a module version, it removes that version from the UI but does not clean up associated files from S3.

We are automatically creating versions of our modules for pre-release testing via a policy. Over time, we’ll accumulate thousands of these pre-release versions. As they’re only useful for a short time, we would like to be able to clean them up fully using the existing delete button / API.

Having this functionality would ensure we can use this policy without creating a large bill for S3 storage of versions that are no longer needed.

Our workflow in full:

1. Create a PR to add functionality to one of our modules
2. Automatically create a version to test that module via policy e.g. 0.0.0-pre-df5abd0
3. Test the change by running a plan against some existing infra using that pre-release version
4. Merge the module change, generating a production version like 1.1.0
5. Hit the delete button or API on module version 0.0.0-pre-df5abd0

At this point, version 0.0.0-pre-df5abd0 has no further use-case, and is not applied to any resources. It’s been removed from the UI, but not from S3.

Workaround
Problem
Status: ✅ Completed1 comment

Log in to comment and vote

Comments1

  • Black Breeze

    •

    May 10, 2025

    On it.