Split Terraform S3 Lifecycle Ownership Caused Silent Data Cleanup Failures
A developer building a media upload system discovered that uncommitted S3 objects uploaded via presigned URLs had no cleanup path because committed and uncommitted files shared the same key prefix. The fix introduced a tmp/ prefix namespace, where unconfirmed uploads expire after 7 days via a lifecycle rule, while validated files are promoted to their final keys using CopyObject. During deployment, the Terraform apply failed because two separate Terraform resources each managed lifecycle rules on the same S3 bucket, unaware of each other. Since S3's PutBucketLifecycleConfiguration replaces the entire lifecycle document rather than appending rules, each resource would overwrite the other's configuration. The incident also surfaced three security and logic defects in the promotion flow, including an idempotency bug and an arbitrary copy primitive, all of which were patched before rollout.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in