https://pulumi.com logo
#getting-started
Title
# getting-started
p

purple-optician-77844

07/19/2023, 10:25 AM
When renaming stacks (
pulumi stack rename
), what is the best way of updating other stacks that have
StackRefrences
to the original name of the renamed stack? There doesn't look to be an update for those stacks.
s

salmon-account-74572

07/19/2023, 3:28 PM
Correct, you’ll have to update stack references manually. I usually recommend making the stack name a configuration parameter you can pass into your program via
pulumi config set
to simplify this process. We talk a bit about this idea in our blog post on recommended practices for stack references: https://www.pulumi.com/blog/iac-recommended-practices-using-stack-references/
p

purple-optician-77844

07/19/2023, 3:29 PM
Thanks, @salmon-account-74572 - What's the process for the manual update? Does that imply manually editing the name within the JSON? (And how would that avoid interacting with the magic number in the manifest)
s

salmon-account-74572

07/19/2023, 3:32 PM
If memory serves correctly, the URNs in the referring stack use the name of the stack reference object, and don’t refer directly to the original/source stack. So as long as you don’t change the name of the stack reference object in your code, then a
pulumi up
should show no changes. (It’s been a bit since I tested this scenario, so I may be mistaken.)
p

purple-optician-77844

07/19/2023, 3:34 PM
Thanks... that makes sense. FWIW, what I did see is that if a rename a stack, then
pulumi refresh
on a referring stack will fail because it can't find the renamed stack. I'll read through what you linked and work through a few more scenarios here.
s

salmon-account-74572

07/19/2023, 3:40 PM
Let me know if you run into additional questions, we’re happy to help.
p

purple-optician-77844

07/19/2023, 3:43 PM
Thanks again... I think my particular instance of this issue might be unusual. We have a couple self-hosted backends and recently created a few more. Some were created before project scoped stack support was added and some after. (So they have different rules for parsing stack names, and I had to update stack names to work in the newer backends)
Combine that with the fact I didn't parameterize the stack names.... 😞
s

salmon-account-74572

07/19/2023, 3:50 PM
Gotcha. If we can help further, please let us know.
2 Views