mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
A resource's DeletionPolicy attribute was never read off the template, so every managed resource was deleted regardless of what it declared: deleteStackResources and rollbackCreatedResources both called provisioner.delete unconditionally. Read DeletionPolicy alongside Type in executeTemplate and apply it at both delete sites. Retain keeps the resource on every stack operation. RetainExceptOnCreate keeps it too, except when the create that made it is rolled back — deleting it there is the entire meaning of that value, and rollbackCreatedResources runs only for a failed create. A retained resource is reported as DELETE_SKIPPED, on the resource and as a stack event, and is not counted as a failed delete, so the stack still reaches DELETE_COMPLETE. That also lets a stack owning a non-empty S3 bucket be deleted, which otherwise fails on the objects. Any other value falls through to the existing delete. That includes Snapshot: floci cannot take the snapshots AWS supports for those types, and AWS does delete the resource under Snapshot, so Delete is the faithful half. The docs record that and the other divergences. The policy is set on the resource after the provisioner returns, because provision() and executeNestedStack() both return a fresh StackResource that replaces the map entry. Closes #1555