03/17/2022, 3:30 PM
Hi everybody, Is there a way to change a resource ID without hacking the stack state or bastardizing resources with aliases? If I could manage this using the CLI, that would be great. Many thanks!


03/17/2022, 3:47 PM
Just to check. It's name or it's ID?
If you really mean ID then I assume you've got two resources one that the stack currently points to, and another that you want to point to instead. In which case you can use the import resource option to delete the current one and adopt the new one.
If you mean name then
pulumi state rename <resource URN> <new name>
lets you rename a resource handling all the other state file changes required due to the new name.


03/17/2022, 5:22 PM
This is great. Thanks @echoing-dinner-19531. I wish to prevent some resources from being created under new names, as they were imported into our current state with names that do not match our existing naming conventions.
BTW, I was referring to resources names (not URNs)