hey all, does anyone know how to property migrate ...
# getting-started
d
hey all, does anyone know how to property migrate resources if provider are changing? Let's say we have provider A that does XYZ, But there is alternative provider B that does XYZ asl well. From the pulumi stand point resources provisioned by those providers are different where in fact they are not. Any suggestions?
l
Here's my OTT but zero-redeploy technique: 1. Put the new provider in. Associate it with something new and run
pulumi up
, so that it's in your state and used. 2. Export your state. 3. Make a backup of your state file. 4. Review your state file to figure out what replace expression you can use to replace all uses of A with B, without changing the definition of A. 5. Import your state. 6. Run
pulumi up
to verify there are no changes.
c
Pulumi aliases allow you to alias the urn as well as the type token too (along with many other parameters.) Or you could go the route @little-cartoon-10569 suggests as well. https://www.pulumi.com/docs/intro/concepts/resources/options/aliases/
d
O nice....
l
Do aliases help when changing the provider? The provider is not in the URN, it's a hidden property of the resource...
d
I am also looking into transformation... That may be useful...
l
Yes, hadn't thought of that, transformations can change opts..
d
hm ... yeah .... That would be awesome If I cloud say pulumi that reassures A is Alias of the resource B and how to transform from A to B.
l
Should be possible. Let us know how it goes!
c
Do aliases help when changing the provider? The provider is not in the URN, it's a hidden property of the resource...
Ah good point. They don't. Provider resources are referenced by URN in a property called
provider
for each non-provider resource, so those will need to be searched/replaced in the checkpoint. Also I wonder if there is some provider trickery that is possible here. For example, define an explicit provider with provider B, and specify aliases + the explicit
provider
option in the
ResourceOptions
. This may be cumbersome and perhaps not practical depending on how large the project is.