When renaming stacks (`pulumi stack rename`), what...
# getting-started
When renaming stacks (
pulumi stack rename
), what is the best way of updating other stacks that have
to the original name of the renamed stack? There doesn't look to be an update for those stacks.
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/
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)
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.)
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.
Let me know if you run into additional questions, we’re happy to help.
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.... 😞
Gotcha. If we can help further, please let us know.