https://pulumi.com logo
#getting-started
Title
# getting-started
d

dry-potato-52542

11/17/2022, 6:33 PM
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

little-cartoon-10569

11/17/2022, 7:13 PM
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

clever-sunset-76585

11/17/2022, 10:33 PM
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

dry-potato-52542

11/17/2022, 10:34 PM
O nice....
l

little-cartoon-10569

11/17/2022, 11:04 PM
Do aliases help when changing the provider? The provider is not in the URN, it's a hidden property of the resource...
d

dry-potato-52542

11/17/2022, 11:05 PM
I am also looking into transformation... That may be useful...
l

little-cartoon-10569

11/17/2022, 11:11 PM
Yes, hadn't thought of that, transformations can change opts..
d

dry-potato-52542

11/17/2022, 11:24 PM
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

little-cartoon-10569

11/17/2022, 11:25 PM
Should be possible. Let us know how it goes!
c

clever-sunset-76585

11/18/2022, 12:05 AM
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.
3 Views