Updating dependent stacks
As the other answer suggested method looks a bit longer, here is what I did to overcome this problem after reading this guide:
- I have updated importing stack (i.e.
stack-lambda
) to use actual value of exported parameter(I did that using AWS console so that I don't have to make change in my yml code, submit and deploy) - Deploy exporting stack (i.e.
stack-layer
) and make sure that the issue is gone - Deploy importing stack from code base.
This was done quite quickly w/o changing source code and interrupting service run. Hope this will be useful, feel free to comment your questions.
As described in Fn::ImportValue
documentation, being unable to modify a referenced output is indeed expected behavior:
Note
The following restrictions apply to cross-stack references:
[...]
- You can't modify or remove an output value that is referenced by another stack.
In order to work around this when updating the output, you can use a second, temporary Output value to handle the transition:
- Update
stack-layer
to add a second Output containing the new value (e.g.,layer-arn-2
); - Update
stack-lambda
, changing the"Fn::ImportValue": "layer-arn"
reference to instead referencelayer-arn-2
. - Update
stack-layer
to remove the now-unusedlayer-arn
Output.
(Or alternately: updatestack-layer
to setlayer-arn
to the same value aslayer-arn-2
; updatestack-lambda
to referencelayer-arn
; then finally updatestack-layer
to remove thelayer-arn-2
Output.
It's a bit tedious, but it should work.