https://pulumi.com logo
Title
a

ambitious-father-68746

05/19/2021, 11:03 PM
Hi, I have some resources already created, but now I feel the need to explicitly configure and define a provider and then reference it in my resources using
pulumi.ResourceOptions
. Unfortunately Pulumi wants to destroy the resources that I already have. Is there a way to move resources from the default Provider configuration to a new one?
l

little-cartoon-10569

05/19/2021, 11:26 PM
The only way I've found to do this is to export the stack, edit the provider by hand, and import the stack.
And you need to have the new provider defined (and possibly in use?) before exporting, so that you can copy its URN to the resources you want to update.
a

ambitious-father-68746

05/19/2021, 11:43 PM
Good call, that was what I thought of doing as well. Thanks!
s

sticky-bear-14421

05/20/2021, 6:55 AM
Is there an option to import the existing resources with the other provider? Would save you from editing the stack if such an option exists
l

little-cartoon-10569

05/20/2021, 7:59 PM
Yes,
pulumi import
has a
--provider
parameter. You'd have to remove the existing resource from state first, which is easy unless you have lots of dependencies on it