Nested Stack Change Set Evaluation
Duplicate of https://forums.aws.amazon.com/thread.jspa?start=0&threadID=228489&tstart=0, posted Mar 30, 2016.
The current behavior of evaluating a change set on the "root" stack is that all nested stacks will show "conditional" changes regardless if the underlying templates at the TemplateURLs have changed.
This enhancement request is for recursive change set evaluation for nested stacks. Ideally, a change set evaluated on the "root" stack should show all additions/replacements/deletions/changes for all child stacks recursively. It should also automatically resolve any inter-stack dependencies and evaluate those as part of the changes.
Agreed, without recursive change set the risk of unintended change is significantly higher just like the old days before change set was a thing. we need that visibility.
I second that. I've been thinking about computing change-sets manually myself for sub-stacks, but it's a major pain I wish AWS could solve for me. It feels rather undifferentiated cruft, but super important for reducing risks to updates.
See also https://github.com/aws-cloudformation/aws-cloudformation-coverage-roadmap/issues/224 about new UpdateReplacePolicy options so every change set Replacement value no longer needs evaluation
See also this thread Change set support for nested stacks? at Mar 30, 2016
Any pointers on when this will be released or at least move to Work in Progress?
This is a bigger work item than a typical service coverage ask so needs a bit more investment in design and engineering. It's being looked at, but I can't offer any more specific timeline than that at this time.
This is a bigger work item than a typical service coverage ask so needs a bit more investment in design and engineering. It's being looked at, but I can't offer any more specific timeline than that at this time.
Thanks Dude, we know its a big task and appreciate that you guys are looking at investing in this, its an important feature to safe usage of nested stacks.
Is there an update on this?
All my stacks are "modularized" using nested stacks. Unfortunately, I have reached a point where it is scary updating a root stack as I'm not 100% sure what will happen in the child stacks. This is a critical feature in my opinion.
@rjlohan We had 4th anniversary 2 days ago since this issue was reported on aws forum (https://forums.aws.amazon.com/thread.jspa?threadID=228489&start=0&tstart=0) so please don't state the obvious like "it's bigger work item". Instead, could you please provide any information when (or rather if) this feature can happen?
@rjlohan We had 4th anniversary 2 days ago since this issue was reported on aws forum (https://forums.aws.amazon.com/thread.jspa?threadID=228489&start=0&tstart=0) so please don't state the obvious like "it's bigger work item". Instead, could you please provide any information when (or rather if) this feature can happen?
@rjlohan Can you at least tell us if this is possible and whether there is the will to do it. If not I will be looking elsewhere re IaC on AWS, but at least it gives us a better position to make a decision. We need to know whether we should give up on the numerous modules we wrote using CloudFormation and rewrite them using something else, or whether to wait just a bit more. Its been 4 years, the least we deserve is a straight answer even if it doesn't include a timeline.
+1 On this being an important feature.
CloudFormation best practices are to use nested stacks, and when making an update, to do that update to the parent stack. However the parent stack doesn't provide visibility into the changes being made. It seems like those are conflicting best practices to me.
I'm at the point where I'm considering getting rid of nested stacks completely and moving to a model of 1 massive CloudFormation file.
Update on that theory, there is a limit of 200 resources on a given CF stack, so my model of moving to 1 massive CF file is not even possible. Now I seem to be at a crossroads and I have 2 options forward.
-
I move away from CF altogether and onto Terraform which is a bummer for me. I like terraform for a lot of reasons, but specific to this issue I like the fact that terraform shows me exactly what is going to change when making an update. I don't like the fact that we are heavily invested in the AWS ecosystem, and something as small as this issue is the dealbreaker.
-
I have to create some sort of changeset automation. Essentially running changesets against my nested stacks and pass those changes back up into a central location for me to view. I don't want to have to create a workaround like this. Especially considering it seems like this is exactly what CF should be doing in the first place. All the tools and information are there for me to create this automation, so why can CF not natively do this?
I understand it's a bigger work effort, but like I outlined above, it seems like all the tools and information are already there, so how hard could this really be to implement?
I thought about 2 as well. However, if the nested stacks use attributes from other resources, you would not be able to determine if they get updated or not until the resources have updated.
For example, let's assume the nested stack needs a resource ARN from its parent stack. In a subsequent update, a property is changed on that resource. If the property can be updated in-place, then nested stack has no changes, but if the property requires replacement of the resource, then the nested stack needs to update as well.
Implementing 2 is equal to "better to go to another solution". I am still under the hope that CF will someday announce the changeset feature availability. Downsides of this I have recommended people to not take this solution as its risky to rely on a CI/CD model that deploys nested stacks. The value of the CF just goes down because of this problem. I think even if this feature is complex to implement, any small indicator around the changeset would do that would keep the customers using CF.
@bjorg
Yes, however you request update of master stack. This means you are able to calculate master's replacements before calculating parameters used by nested ones. That comes down to proper recursive calculation - I admit that it wouldn't be trivial one but definitely possible. And it is useful/necessary exactly because it is not a trivial task.
For those thinking about ways to work around this, in some cases you can also work with layered / paralel stacks. This article does a pretty good job explaining how that works. I personally haven't had a stack that couldn't be split up this way (although I know the number of resources can climb quickly for lambda + api-gw stacks):
https://blog.rowanudell.com/cloudformation-layer-cake-pattern/
Actually, even without knowing what changes (i.e. update vs replace) might occur, it would still be beneficial to do a structural comparison on the nested stack. That said, if it contains conditional logic, it may be difficult to determine what is triggered without knowing the parameter values.
@Patrick-56Bit Yes, we believe it is possible; yes, there is enough will to do it. This remains a top customer ask. I've just got an update from the team assigned to do this work. Transparently; we may be able to show progress on this early next year, but we’re being particularly mindful of operational implications and backwards compatibility challenges we’ve found as we’ve done deep research on this recently.
@rjlohan so that means early next year, that's it? We use cloudformation to handle dozens of accounts/applications (with use of nested stacks). However we are still experiencing to have cloudformation API kinda "half-baked" and features are being released in a hurry without full support. We have to "fix" lot of them with custom macros. If I have to wait another year for such crucial functionality like changesets for nested stacks, it is maybe feasible to migrate hundreds of templates into terraform. I was hoping that AWS can show the same pace for fixing issues with current services as bringing new ones.
@mliner I agree with you that AWS is way too slow to fix and improve this compared to launching new services. We are slowly migrating away from Cloudformation because of this. But we found it easier to use the AWS CDK, which is a high-level API to Cloudformation, then going towards a completely different system like Terraform (which btw is also fantastic). We are still in the beginning of this process so may revert our decision and go to Terraform, but till now CDK is working great.