CloudFormation: stacks might become undeployable because replacement breaks resource relationship constraints #847
Labels
@aws-cdk/aws-cloudformation
Related to AWS CloudFormation
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/medium
Medium work item – several days of effort
feature/enhancement
A new API to make things easier or more intuitive. A catch-all for general feature requests.
feature-request
A feature should be added or improved.
needs-design
This feature request needs additional design work.
p1
The situation
internetFacing = false
, and now I want to switch it tointernetFacing = true
. This change causes replacement of the load balancer.The problem
For rollbackability, CloudFormation is going to create a new Load Balancer first, and try to associate it with the TargetGroup (which didn't change). This breaks the "Target Group can only ever be associated with one Load Balancer" constraint, and the deployment fails.
This means I can never deploy this update anymore!
The workaround
What needs to happen is that the Target Group gets replaced as well. This will happen if it's logical ID changes, so an easy "enough" workaround is to change its construct ID.
Still, this is not a great experience because:
The better solution
Resources that have a constraint to other resources should have some way of incorporating the immutable values of the other construct into their own logical ID hash.
That way, we can automatically regenerate the ID of the TargetGroup if something on the LB changes, and cause the replacement that we want to happen.
This is feasible because we have the list of immutable properties in our schema, so we can actually calculate this hash.
Potential downsides
The text was updated successfully, but these errors were encountered: