Hey all, not sure if this is the right channel for...
# aws
a
Hey all, not sure if this is the right channel for this. But I am currently using a micro stack approach. I have thousands of lines of base infra structure code and hundreds of line that live with the services that they support. I have 10 or so microservices in my app. I am cleaning up our base infra code and I found several thing that belong under some of the microservices. What is the best way to move resources to another project and stack? I do not want to delete from infra and then recreate in the other stack because down time might be an issue. My thoughts are to delete these resources from the pulumi state on the infra stack remove the code from the infra file. Then import those resources into the appropriate stack. That seems like a lot of work though, tedious, and prone to error. Figured I would ask those that are smarter than me before I embark on this journey. I appreciate any advice around this.
l
Unfortunately, you will need to move the code by hand. While I've never tried to use aliases to move resources between projects and stacks, the definition of the Alias interface implies that you can, and you won't need to evict the resources from one project and import them into the other. The Alias interface allows you to specify the old resource's project and stack as well as type, name and parent: if project and stack work the same way as the other properties, then Pulumi should move the resource for you just by using the alias opt. You just need to look after the code.
Presumably, this requires that both the old and new projects are in the same backend.
a
Thanks Paul. I will look Into this. I was afraid of that.