I have Cloudformation with multiple nested stack templates. In the below sample, I want to create the Route53 resources after the load balancers have been created so I put DependsOn LOADBALANCER stack to ensure the nested templates are created in order. This works. However, if I already have everything created and do an update by changing the “CreatePrivateLoadbalancer” parameter to false, the stack update fails because it tries to delete the PrivateLoadbalancer first, but it cannot because ROUTE53 stack is using the output of PrivateLoadbalancer. Ideally, it should delete the ROUTE53 resource first then delete the LOADBALANCER resource. Any suggestions?
"LOADBALANCER": {
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"CreatePublicLoadbalancer": { "Ref": "CreatePublicLoadbalancer" },
"CreatePrivateLoadbalancer": { "Ref": "CreatePrivateLoadbalancer" },
},
"TemplateURL": "s3://loadbalancer.json",
}
},
"ROUTE53": {
"DependsOn": ["LOADBALANCER"],
"Type": "AWS::CloudFormation::Stack",
"Properties": {
"Parameters": {
"CreatePublicLoadbalancer": { "Ref": "CreatePublicLoadbalancer" },
"CreatePrivateLoadbalancer": { "Ref": "CreatePrivateLoadbalancer" },
},
},
"TemplateURL": "TemplateURL": "s3://route53.json",
}
}
kensooqs is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.