https://pulumi.com logo
#general
Title
# general
a

adamant-dress-73325

10/02/2019, 9:06 PM
@lemon-spoon-91807 Do you know if the stack ref OutputSync bug was fixed? We are doing this in a lot of places, wondering if it was still needed?
Copy code
const vpcPrivateSubnetIds = (stackRef.requireOutputSync("vpcPrivateSubnetIds") as unknown) as Array<
  pulumi.Output<string>
  >;
l

lemon-spoon-91807

10/02/2019, 9:07 PM
which bug are you referring to?
refresh my memory on the problem.
a

adamant-dress-73325

10/02/2019, 9:09 PM
We were getting undefined as value when passing the stack ref to FargateService
l

lemon-spoon-91807

10/02/2019, 9:09 PM
what would you like to write instead?
i'm not seeing a problem with the above (except hte unncessary 'as's
you should just be able to do:
const vpcPrivateSubnetIds = <string[]>stackRef.requireOutputSync("vpcPrivateSubnetIds")
a

adamant-dress-73325

10/02/2019, 9:10 PM
l

lemon-spoon-91807

10/02/2019, 9:11 PM
yes. the riht solution is just getOutputSync (or requireOutputSync)
it's effectively 'by design' that getOutput returns an
Output<whatever>
and its by design that vpc.fromExistingIds needs a realized list of values.
a

adamant-dress-73325

10/02/2019, 9:12 PM
ok, I will remove the extra casts
ty
I see that the type is
pulumi.Input<string>[]
though? Am I misunderstanding that it needs to be unwrapped?
Per
ExistingVpcIdArgs
l

lemon-spoon-91807

10/02/2019, 9:15 PM
"unwrapped"?
so a
string[]
is a
Input<string>[]
a

adamant-dress-73325

10/02/2019, 9:21 PM
Ok, it works, was able to get rid of the extra casts,
Copy code
const vpcId = stackRef.requireOutputSync("vpcId");
const vpcPrivateSubnetIds = <string[]>stackRef.requireOutputSync("vpcPrivateSubnetIds");
const vpcPublicSubnetIds = <string[]>stackRef.requireOutputSync("vpcPublicSubnetIds");
const vpc = awsx.ec2.Vpc.fromExistingIds("vpc", {
  privateSubnetIds: vpcPrivateSubnetIds,
  publicSubnetIds: vpcPublicSubnetIds,
  vpcId
});
l

lemon-spoon-91807

10/02/2019, 9:21 PM
yup yup
gotta run to a meeting. lmk later ift here are other issues youhave!