https://pulumi.com logo
Title
a

alert-spoon-97538

05/16/2022, 6:18 AM
Does anyone have an example of sharing a VPC across micro-stacks? The few examples I've found are not using the outputs to initialize any new resources. It doesn't seem to matter if I
get
,
apply
, or anything I try I can't get the outputs of one stack to do anything relevant on another. Side note, I'm having a hard time understanding why the Type of an output pulled from a StackRef is treated the same as the unresolved outputs in the working stack. The StackRef stack by definition has been applied, all of those output values are known, otherwise Pulumi rightly throws an error.
Closest I've gotten is typecasting an output as an input...
`const networking = new pulumi.StackReference(
other_stack
)`
const vpcId: Input<string> = networking.requireOutputValue("vpcId") as Input<string>
`const vpc = awsx.ec2.Vpc.fromExistingIds(
cluster-vpc
, {vpcId: vpcId})`
v

victorious-church-57397

05/16/2022, 7:45 AM
Have you tried just using
requireOuput
?
We do this in a similar pattern and don't have any issues with it
a

alert-spoon-97538

05/16/2022, 4:17 PM
Thanks for the tips. Just using
requireOutput
now is working for me though I swear I tried that previously. I think part of the problems I'm running into are related to Crosswalk vs Classic AWS. ECS Crosswalk for instance won't take just a vpcId for the vpc like some of the classic options and I couldn't get it to work by hydrating the vpc from non-crosswalk examples I saw either.