https://pulumi.com logo
Title
g

gorgeous-minister-41131

03/27/2023, 10:36 PM
Is there a recommended/safe-way to migrate a resource from one provider to another, assuming it's the same thing? (e.g. an aws provider). Going from default to explicit provider, for example.
Reimporting all of the resources seems cumbersome...
l

little-cartoon-10569

03/27/2023, 10:49 PM
Someone did have a nice answer for this a few months ago.. I'll see if I can find it.
If you have lots of resources to change, than you can export the stack, search-and-replace, and import it. So long as you have both providers in the stack before exporting, this isn't too hard (though it is slightly scary..).
Can't find the thread I'm thinking of. It may have rolled off the back of Slack. I did find this discussion: https://github.com/pulumi/pulumi/issues/8959 There's a workaround mentioned: https://github.com/pulumi/pulumi/issues/8959#issuecomment-1347699976 But afterwards, Luke implies that is should just work?
s

salmon-account-74572

03/27/2023, 11:13 PM
You could also try aliasing the provider (which is very similar to the workaround mentioned in the issue); this would, in theory, prevent any changes to the URNs of the resources.
g

gorgeous-minister-41131

03/28/2023, 12:05 AM
ah yea.
Basically just target the new provider (to create it) and then find/replace the URNs in the stack if I have to. But I'll try the provider aliasing first.
so far Aliasing the provider seems to work! Should only have to do this once so I'm just copying my explicit provider obj so the ARN is the same and I'll just remove the ResourceOptions after.