I'm trying to understand if what I'm doing is itse...
# typescript
b
I'm trying to understand if what I'm doing is itself wrong, or if I'm just going about it the wrong way. Say I have a class
IP
(which isn't a
ComponentResource
), and I have a source
ComponentResource
subclass which provides some
IP
objects as `pulumi.Output`s which are then read by another secondary
ComponentResource
. I can construct those
IP
objects in my source resource from lookups using the provider to find for e.g. the IP a VM has been assigned by DHCP, and create them as outputs based on the outputs from the provider. If all I want to do in that secondary resource is take those IPs as inputs and read properties of them, that works fine. I can access the properties of them directly via
pulumi.output(ip).property
or the long form
pulumi.output(ip).apply((i) => i.property)
. But if I want to invoke functions that are on my
IP
class, e.g.
ip.apply((i) => i.network())
, I get the error
i.network is not a function
. Is there a way to cast/build my outputs such that functions from the class they are of are usable within an
apply
, or is it expected/intended that only properties are resolved/accessible? I would have to take the low-level properties and construct a new IP object to get my functions, maybe:
ip.apply((i) => (new IP(i.addressWithCidr)).network())
. Is it in any way different if the output is a 'primary' resource from a provider, instead of one I have constructed. Can you invoke functions from the provider resource in that case?