When this removal policy is applied, the resource will be physically destroyed when it is removed from the stack or when the stack is deleted.
This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained in the account, but orphaned from the stack. Most resources default to this removal policy.
Resource will be retained when they are requested to be deleted during a stack delete request or need to be replaced due to a stack update request. Resource are not retained, if the creation is rolled back.
The result is that new, empty, and unused resources are deleted, while in-use resources and their data are retained.
This uses the 'RetainExceptOnCreate' DeletionPolicy,
and the 'Retain' UpdateReplacePolicy, when applyToUpdateReplacePolicy is set.
Possible values for a resource's Removal Policy
The removal policy controls what happens to the resource if it stops being managed by the Engine. This can happen in one of three situations:
The Removal Policy applies to all above cases.
Many stateful resources will accept a
removalPolicyas a property, typically defaulting it toRETAIN.If the resource does not accept a
removalPolicyargument, you can always configure it by using the escape hatch mechanism, as shown in the following example: