Does anyone have an example of sharing a VPC acros...
# aws
a
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
Have you tried just using
requireOuput
?
We do this in a similar pattern and don't have any issues with it
a
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.