https://pulumi.com logo
Title
w

wet-noon-14291

03/19/2021, 8:08 AM
Let's say that you use pulumi to provision a set of resources that should be "stable". If you later on would like to wrap those resources in a ComponentResource where the ComponentResource becomes the parent, is it possible to do so without deleting the set of resources and re-create them? What I would like to happen is that everything would remain the same and the resources just gets marked with a new parent, as long as they have the same name... but maybe that is the case?
or do I have to manually modify the stack in this case somehow?
b

bored-oyster-3147

03/19/2021, 12:48 PM
hmmm maybe you need to import them from within your new component resource? It's a bit weird when they're coming from the same stack though I suspect at some point in that transition they will be flagged for deletion because the dependency tree will have changed
w

wet-noon-14291

03/19/2021, 1:03 PM
exactly, and that is my question. Is it possible to make that type of change without the deletion?
b

bored-oyster-3147

03/19/2021, 1:09 PM
Well the parent property is just an URN, right? You could manually modify the state file and just update the parent property of those resources. But short of that I don't think there is a clean way to do this.
w

wet-noon-14291

03/19/2021, 1:11 PM
That was what I was thinking as well @bored-oyster-3147, but it feels like that approach is quite sensitive to errors.
b

bored-oyster-3147

03/19/2021, 1:12 PM
Or you could make a second stack, and start with your component resource, and import the resources from the original stack into the new stack under the component resource
w

wet-noon-14291

03/19/2021, 1:13 PM
that was also an approach that crossed my mind... No need to do it now, but I see that might be something I want to do down the road.