sparse-intern-71089
03/29/2021, 11:15 PMbillowy-army-68599
wonderful-napkin-50018
03/29/2021, 11:21 PMwonderful-napkin-50018
03/29/2021, 11:22 PMconst vpcId = infra.requireOutputValue('vpcId');
const vpc = new awsx.ec2.Vpc('staging', { vpcId });
export const vpcSubnets = vpc.publicSubnetIds;
vpcSubnets will be empty here.wonderful-napkin-50018
03/29/2021, 11:25 PMbillowy-army-68599
export const vpc
wonderful-napkin-50018
03/30/2021, 12:22 AMawsx.ec2.Vpc
object (to pass to other objects)red-match-15116
03/30/2021, 2:16 AMVpc
object. You can export the vpc’s id as a stack reference and in another stack “import” it into your code with a resource’s .get()
method. https://www.pulumi.com/docs/reference/pkg/aws/ec2/vpc/#look-up
EDIT: I now realize you’re using awsx
and not aws
. I actually don’t know if it’s possible to hydrate an awsx.Vpc
component using an id, since it’s actually a collection of individual resources like Vpc and Subnet amongst others. To use the exact same awsx.Vpc
object that you have in one project you would probably need to create an npm package of your object and import (as a node module) into your other project like any other javascript code.cool-fireman-90027
03/30/2021, 12:56 PM