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

steep-portugal-37539

09/10/2021, 4:38 PM
Hey guys, how is
opts
supposed to be handled by resources and components inside of a new component resource you are creating? So if I pass in a
provider
via
opts
to the new component do I need to merge it with every sub resources’ opts ? Can the sub resource say, just have
parent
specified? Also, What is the role of passing
opts
to
super
?
b

billowy-army-68599

09/10/2021, 5:14 PM
So if I pass in a provider via opts to the new component do I need to merge it with every sub resources’ opts ?
No, a component inherits all properties from the parent component. You can also pass multiple providers to a component if you're missing resource types
s

steep-portugal-37539

09/10/2021, 5:39 PM
Thanks! This makes things easier 🙂
Hey Lee 🙂 I think i may still be a bit confused on this matter Say I make component X which will be a specific type of k8s Ingress I have a function (not a class extending component resource) that X calls to create the ingress with the given params for the specific ingress spec. The ingress that is created by said function, does it need to have passed into it
{parent: thisContextOfSpecificIngress, opts: specificIngressOps}
? Will it work for just a plain function to not have to pass this info? Or does this function really need to be a class extending component resource to get the opts? If it needs to be a component resource, i can’t conceptualize that well. Bec it is really just a helper/factory class to take in args and produce an ingress resource. It isn’t meant to be its own standalone component that is used by people. Its function is for internal use
b

billowy-army-68599

10/18/2021, 9:16 PM
sorry, the question isn't really resonating with me I'm afraid, trying to wrap my head around it but it's hard to internalize
s

steep-portugal-37539

10/19/2021, 6:36 PM
Maybe i can sum down the question to this: Any ComponentResource that either has internal methods or calls external functions, if those functions create new resources, such as a k8s ingress, does that ingress automatically get the opts provided to the top level ComponentResource? I know up above you seemed to say yes. But is it required to set the
parent
of the ingress for the rest of the opts to be passed along? How does a resource’s opts being configured work? In what circumstances would I need to explicitly pass opts to a resource?