Handling errors
The default and the only 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 resource fails, CloudFormation won't be able to clean up.
For example, we create the WebTier stack, setting DeletionProtection
to True
on the LoadBalancer
.
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" &...