Handling errors
The default behavior of CloudFormation stack deployment in response to errors is to roll back to the previous state.
While this is the proper way to manage a production infrastructure, it might introduce various issues. For example, if you create resources with termination protection and the creation of those resources fails, CloudFormation won’t be able to clean up.
For example, let’s say we create the WebTier stack, enabling deletion protection on the load balancer.
This is what our load balancer resource looks like:
// webtier_failing.yaml WebTierLoadBalancer: Type: «AWS::ElasticLoadBalancingV2::LoadBalancer" Properties: Type: application LoadBalancerAttributes: - Key: «deletion_protection.enabled" &...