https://pulumi.com logo
#general
Title
# general
s

swift-intern-18856

10/20/2021, 3:28 PM
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

freezing-van-87649

10/20/2021, 4:01 PM
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

swift-intern-18856

10/20/2021, 4:10 PM
awesome!! thank you, that's so helpful, much appreciated
👍 1
f

freezing-van-87649

10/20/2021, 4:16 PM
very welcome