bland-monitor-37952
06/27/2025, 12:36 PMIP
(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?No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by