Morning all.. anyone know how to reference complex...
# aws
p
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
Which input property has the type
Input<string>[]
?
p
On
awsx.ec2.ExistingVpcIdArgs
both fields for subnetIds:
privateSubnetIds
publicSubnetIds
t
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
aaah right. Is there any way to coax a conversion so that i can use them?
t
How do you get those outputs? Are you using
getSecret
?
p
no, they're via a stack
requireOutput
t
Any chance you can
await ref.requireOutputValue("...");
?
p
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
Yeah, this is a known challenge https://github.com/pulumi/pulumi-awsx/issues/522
p
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
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
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
@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.