https://pulumi.com logo
Title
f

fierce-cat-91199

10/13/2021, 9:29 PM
Hi everyone, I hope someone can help guide me! I have deployed some resources. I then refactored my code so those resources are now nested under a
ComponentResource
Is there a way to reimport these resources so that I don't have to delete and recreate them?
b

broad-dog-22463

10/13/2021, 9:34 PM
Hi @fierce-cat-91199 you may be able to read this blog post to help you use aliases https://www.pulumi.com/blog/cumundi-guest-post/
f

fierce-cat-91199

10/13/2021, 9:35 PM
Thanks Paul I'll read this! 🙂
I've had a read and trying but it seems Pulumi still wants to delete and create again. Unless that's what it says, but it will just update the parent/child relationship?
what would the output of a
preview
look like when re-parenting?
I figured it out 🙂 Had to set
NoParent *=* true
then preview showed no changes. Did an
up
and checking
pulumi stack
the resources are successfully re-parented
Interestingly, setting
ParentUrn
to the URN of the root stack did not work. I would have thought that's the same as saying "no parent". Anyhow it's all working
l

little-summer-88406

10/14/2021, 7:55 AM
Can you remove the alias stuff after the first migratory
pulumi up
? Or does it have to exist thereafter?