https://pulumi.com logo
Title
f

full-artist-27215

05/13/2021, 8:42 PM
question about component resources and registering new outputs... is there special syntax for accessing those outputs later? I have code like this to register the output:
self.register_outputs({
    "endpoint":
    pulumi.Output.concat(
        "redis://",
        self.cluster.cache_nodes[0].address,
        ":",
        str(self.cluster.cache_nodes[0].port)
    )
})
but when I go to use it like this:
cache.endpoint
I end up with the following:
AttributeError: 'Cache' object has no attribute 'endpoint'
(this is all Python, BTW). Thanks in advance 🙇
l

little-cartoon-10569

05/13/2021, 8:44 PM
Component resources are normal classes / objects in your language. You need to have a public property "endpoint" to access that.
register_outputs()
is used to register the property with Pulumi, as something that can be a stack output.
f

full-artist-27215

05/13/2021, 8:45 PM
ah, gotcha... thanks, I'll give that a try.