Add lifecycle configuration to delete objects under a certain size to remove destroyed states
Describe the Feature
It's nice to look at the s3 state bucket to see which components and root dirs contain resources
After destroying root components and resources, the state file object continues to exist in s3. The state object has very few characters in there. It would be nice to expire these objects when they are less than a certain number of bytes.
Expected Behavior
Expire s3 state objects when the objects are less than N bytes
Use Case
See above
Describe Ideal Solution
Lifecycle rule
Alternatives Considered
N/A
Additional Context
- https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html
It's kinda sketchy to do this, but I would like to see it if it's possible... We do enable versioning by default, right? So that should give us some confidence that this won't just outright destroy state that is actually being used. That said, I could see this being a problem... added some labels to see if anyone wants to implement and then we can discuss more once it's in a PR.
Coming back to this issue and realizing we should see if the Cloud Posse folks think this is a good idea or not. I'd lean towards not, but just to go full circle on this issue I figured we should put it up for discussion with the real decision makers.