Inspired by <@U01MV4U2EV9>’s video on functional s...
# sst
r
Inspired by @thdxr’s video on functional stacks, I thought I’d try converting my very simple Arduino powered “oh crap, somebody’s pressed the button on the garage door opener by accident and left it open all night monitor” (working title) application. I have an SNS topic that is published to when the APIGW endpoint receives a call from the Arduino. I didn’t change anything about the stack, other than defining it using functions but when I try to deploy I get an error about the topic already existing in the stack. Is this expected and, if so, is there a way to deal with it without tearing it all down and rebuilding?
t
we should probably make this clearer in the migration docs but with functional stacks the id is generated based on the function name so if you're converting existing stacks the function name might not match so it'll create a new stack you can override the automatic id with
Copy code
app.stack(MyStack, { id: "my-stack"})
r
Great, thanks, it sees no changes after doing that which is correct. Weird error msg though from CloudFormation given that it must have thought there was a different stack due to the new ID
a
I just had the same thought about the tearing down and rebuilding again, this answers that, though I will have to be very thorough about it. Thankfully most resources are just imports and so they’ll be safe but there’s no point in being hasty and risking outage for the end users.
t
definitely recommend sst diff to verify before deploying
a
yep, makes sense.
r
One of these years they'll support renaming things 😂