https://pulumi.com logo
Title
b

bitter-toddler-22112

03/19/2020, 3:23 PM
Hi guys, I'm new to typescript and don't know how it implements strong or weak typing, serialization and so on. Anyways, my Problem is that in one stack I export an object of type eks.Cluster. In another stack where I get it as output, it is of Type Output<any>. How can i cast it to eks.Cluster so that I can access its fields like eksCluster.nodeSecurityGroup.id and so on? Thx for your help!
w

white-balloon-205

03/19/2020, 11:17 PM
Across stack boundaries, things get serialized to JSON, so there are not strong types available across the two - and you cannot in general return a fully-instantiaed resource object. You'll likely want to export specific cloud resource ids and then on the other side call
Res.get(id)
to re-hydrate a resource from the cloud directly.
b

busy-magazine-48939

03/20/2020, 2:50 PM
Hi @white-balloon-205, what if my resource is from awsx and doesn’t have get(id) function. For example: there is
aws.lb.getLoadBalancer()
method , but there is no
awsx.lb.getLoadBalancer()
one. How do I go about it? Basically my
awsx.lb.ApplicationLoadBalancer
and
awsx.ecs.Cluster
are defined in another stack and I need to reference them somehow in another one.
w

white-balloon-205

03/20/2020, 4:20 PM
That is not currently possible. You would need to identify which AWS resources in particular you need in the other stack, and export the `id`s of those. I've opened https://github.com/pulumi/pulumi/issues/4133 to track this, as its come up several times. Feel free to upvote or leave additional notes.
👍 1