https://pulumi.com logo
Title
f

full-artist-27215

03/30/2021, 9:29 PM
I have a general modeling question. So far, when creating ComponentResources, I've been storing the child resources as members of my ComponentResource "container", and setting the
ResourceOption(parent=self)
in all the child resources as well. In this way, my programming language object structure and my Pulumi resource structure are the same. Is there any inherent reason that the two should always be the same? That is, if I want to create a child resource and register it for Pulumi with
ResourceOption(parent=self)
, but not keep it around within my ComponentResource "container" (e.g., because I have no need to access any of its properties anywhere else), will that get me into trouble? Likewise, if I were to register the child resource with
ResourceOption(parent=some_other_thing)
, would that give me problems? I think I might be more inclined to do the former than the latter, and can think of some usecases for it, but want to make sure that I'm not running afoul of some implicit assumptions in how Pulumi operates. Thanks.
l

little-cartoon-10569

03/30/2021, 9:33 PM
No, it won't give you problems. The two sets of relationships are unrelated 🙂 Go for it!
🎉 1
f

full-artist-27215

03/30/2021, 9:35 PM
cool... thanks @little-cartoon-10569