https://pulumi.com logo
#aws
Title
p

powerful-furniture-83753

11/26/2020, 10:24 AM
Morning all.. anyone know how to reference complex types across stacks? For example, i have subnet ids that i want to export from one stack to put in another?
Output<string[]>
doesn't seem to convert well to
Input<string>[]
(using typescript btw).
t

tall-librarian-49374

11/26/2020, 10:31 AM
Which input property has the type
Input<string>[]
?
p

powerful-furniture-83753

11/26/2020, 10:35 AM
On
awsx.ec2.ExistingVpcIdArgs
both fields for subnetIds:
privateSubnetIds
publicSubnetIds
t

tall-librarian-49374

11/26/2020, 10:37 AM
I suspected it was
awsx
. Usually, the type would be
pulumi.Input<pulumi.Input<string>[]>
which looks funky but accepts all combinations of outputs. awsx is sometimes missing this.
p

powerful-furniture-83753

11/26/2020, 10:37 AM
aaah right. Is there any way to coax a conversion so that i can use them?
t

tall-librarian-49374

11/26/2020, 10:42 AM
How do you get those outputs? Are you using
getSecret
?
p

powerful-furniture-83753

11/26/2020, 10:42 AM
no, they're via a stack
requireOutput
t

tall-librarian-49374

11/26/2020, 10:45 AM
Any chance you can
await ref.requireOutputValue("...");
?
p

powerful-furniture-83753

11/26/2020, 10:47 AM
it's top level atm, i mean i could do a then on the promise and do the rest of the code in a function. Not ideal tho
t

tall-librarian-49374

11/26/2020, 10:50 AM
Yeah, this is a known challenge https://github.com/pulumi/pulumi-awsx/issues/522
p

powerful-furniture-83753

11/26/2020, 10:51 AM
kewl, well i'll thumbs up the issue, and probably go forward with the work around for now 🙂 Thanks for the help!
that sample code in the issue is almost literally what i'm trying 🙂
👍 1
l

little-cartoon-10569

11/26/2020, 6:59 PM
My "solution" to this was to merge projects and just pass the Vpc around... So far so good, only one project needs Vpcs, the others usually need individual subnetIds.
👍 1
c

cool-fireman-90027

11/30/2020, 5:08 PM
Here is an example of passing around subnet id’s from one stack to another. https://github.com/pulumi/examples/tree/master/aws-ts-vpc-with-ecs-fargate-py
p

powerful-furniture-83753

12/01/2020, 8:01 AM
@cool-fireman-90027 thanks... unfortunately, as discussed above, the issue is in
awsx.ec2.ExistingVpcIdArgs
taking a wrong input type so that the subnet arrays being passed around don't work.