What do I miss? ``` pulumi.output(new gcp.compute...
# general
b
What do I miss?
Copy code
pulumi.output(new gcp.compute.Subnetwork("z", {ipCidrRange: "111", network: "zzz"})).name;
Error on `tsc --noEmit`:
Copy code
Property 'name' does not exist on type 'OutputInstance<Subnetwork>'.

16 pulumi.output(new gcp.compute.Subnetwork("z", {ipCidrRange: "111", network: "zzz"})).name;
also strange that error doesn't show full type
gcp.compute.Subnetwork
, but just
Subnetwork
basically trying to do:
Copy code
const neteng = new pulumi.StackReference(
    "org/gcp-neteng/prod"
).requireOutput("gke01London") as pulumi.Output<gcp.compute.Subnetwork>;


...
neteng.name;
and it fails. interestingly this change makes it work:
Copy code
).requireOutput("gke01London") as pulumi.Output<Pick<gcp.compute.Subnetwork,'name'>>;
w
The outputs on `StackReference`s are plain JavaScript objects, not fully realized
Resource
instances. You typically need to output an id from one stack, and then
.get
that
id
in the other stack.
b
as unknown as gcp.compute.Subnetwork;
works, but I agree that exporting just ID might be better
I've found why it is like this. Basically
pulumi.Output<Resource>
leaves it with
OutputInstance<Resource>
without
& Lifted<T>
part, that is because of https://github.com/pulumi/pulumi/blob/8fd05fcd9fbd1480c01726b4fc7fcf158e611f99/sdk/nodejs/output.ts#L685 which skips recursing into object properties with
LiftedObject
. pulumi.Output<Pick<Resource, 'id'>> works because that
extends Resource<T>
becomes false and it recurses
I'll create an issue for you to decide whether it is a bug , but it is definitely a usability problem