Hey guys, quick question: I have a resource define...
# general
t
Hey guys, quick question: I have a resource defined in one stack (an AWS vpc) - I want to move it from this stack to another stack. Is there a way to do that without deleting the resource when I delete the code in the initial stack?
l
Stack? Do you mean project?
t
Sorry, yeah
Project
l
Great. Then you can use
pulumi import
, or else copy the code from the old project to the new one, and add the
import
opt. The value to put in the opt is described at the bottom of the resource's API docs page.
Once it's successfully imported, go back to the other project, remove the code for the resource, run
pulumi state delete
on the resource, and then check all is well by running
pulumi preview
.
t
Awesome. Thank you!
l
If you use the
import
opt, don't forget to remove that opt from code once it's imported.