I have a bunch of resources that I want to reparen...
# general
s
I have a bunch of resources that I want to reparent underneath a new
ComponentResource
to logically group them. However, when I run a preview, the provider wants to delete and create all these resources, even though nothing has changed besides the structure of my code. Am I doing something wrong? Or is there a way to work around this?
I can refactor things, but leave the
{ parent: this }
on the resource options out ... this means that the dependency isn't established which kind of defeats the point. I'm not sure why simply establishing the dependency on a logical component grouping would cause the engine to want to delete the existing resources
This seems like weird behavior, nothing else depends on my new component group, it's just a logical grouping for the benefit of clarity.
f
they go over that scenario in the blog post:
Copy code
const serviceAccountSecondCustomerKey = new gcp.serviceAccount.Key("ServiceAccountSecondCustomerKey",
    {
        serviceAccountId: serviceAccountSecondCustomer.email
    },
    {
        parent: serviceAccountSecondCustomer,
        aliases: [
            { parent: pulumi.rootStackResource }
        ]
    }
);
s
awesome!! thank you, that's so helpful, much appreciated
👍 1
f
very welcome