Back with another question :bow: In my invocation...
# getting-started
b
Back with another question 🙇 In my invocation of
new _awsx.lb.ApplicationLoadBalancer_
, how do I reference an
awsx_.ec2._Vpc
instance created in another stack? stack
<org>/infra/dev
Copy code
const vpc = new awsx.ec2.Vpc("dev", {
    cidrBlock: vpcCidr,
    numberOfAvailabilityZones: 3,
    subnets: [...],
});

export const vpcId = vpc.id
stack
<org>/app/dev
Copy code
const infraDevStack = new pulumi.StackReference("<org>/infra/dev");

// Create an ALB associated with the dev VPC
const alb = new awsx.lb.ApplicationLoadBalancer("admin", {
    vpc: aws.ec2.getVpc({
        id: infraDevStack.getOutput("vpcId") as string,
    }),
});
Here,
aws.ec2.getVpc
returns
Promise<GetVpcResult
but I need a
awsx.ec2.Vpc
.
g
You can use:
Copy code
const vpc = awsx.ec2.Vpc.fromExistingIds("myVpc", {
    vpcId: "some-vpc-id"
});

new awsx.lb.ApplicationLoadBalancer("mylb", {
    vpc: vpc
});
b
@green-stone-37839 thanks! I missed that part of the docs