Hello, I have some dynamic infrastructure managed ...
# general
b
Hello, I have some dynamic infrastructure managed via self-hosted Pulumi on AWS S3, and I found that every stack that gets deleted leaves behind a .bak file, which is never ever purged (as far as we were able to tell). Is there any way to handle this in Pulumi, or is writing a custom cleanup system the best practice? Just so that the additional storage does not become a problem long-term.
m
It does seem like this is intentional: https://github.com/pulumi/pulumi/issues/9474 If you're sure you don't need the backups, you can apply a lifecycle policy to the backup files. Since (as far as I know) S3 lifecycle policies can filter only by prefix, you'd have to create a system with S3 event notifications and a Lambda. You could watch for state files being deleted and then put the lifecycle policy on the backup file (assuming that you don't want to delete it right away in case someone made mistake).