I implemented a ComponentResource which creates so...
# general
s
I implemented a ComponentResource which creates some other resources including a gcp.container.Cluster and a k8s.Provider from this cluster. Now I'm searching for a way to add this provider to the ComponentResources providers so that all child resources of my ComponentResource will use the k8sProvider. Is that possible or to I have to provide my new ComponentResource as parent and the k8s.Provider as provider to all child resources. This feels a little bit redundant to me. Is there a way to register providers for a ComponentResource?
f
(edit) I take back what I said. I was looking at the code and forgot we actually do have this 🙂 https://www.pulumi.com/docs/intro/concepts/programming-model/#inheriting-resource-providers
s
I saw this, but I've a order problem here. In the constructor of my ComponentResource I cannot provide the option "providers" for the super call because the k8s.Provider is create later in this same constructor.
So my idea was to somehow add the provider to this providers option after it is created in my constructor.
f
ah, sorry i think i missed that part
i thought perhaps you had a ComponentResource with another ComponentResource inside it
another thought then is could you register a transformation so that the children end up getting the correct provider?