mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
A change to BucketName is a replacement: CloudFormation creates the new bucket first and then deletes the old one, unless UpdateReplacePolicy is Retain. S3CfnProvisioner created the replacement but never removed the displaced bucket, so a successful rename left both buckets, and a rename that a later resource failed ended in UPDATE_ROLLBACK_FAILED, with DescribeStackResources still naming the new bucket. Record the displaced bucket with ReplacementCleanup and delegate the replacement lifecycle to it, so the committed update deletes the old bucket, honouring UpdateReplacePolicy: Retain, and a rollback points the resource back at the original bucket and deletes the replacement. Route the bucket delete through CfnDeletes.safeDelete so a bucket already gone is tolerated while a real failure such as BucketNotEmpty still propagates and reaches the stack as DELETE_FAILED. Fixes #5678 Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>