magnificent-lifeguard-15082
01/06/2022, 5:21 PMec2.Vpc.getSubnets
returns a Promise<ec2.Subnet[]>
as opposed to an Output<ec2.Subnet>[]
. Is this safe to use as an arg (Input) to a subsequent resource where I need to provide a subnet id?billowy-army-68599
01/06/2022, 5:22 PMec2.Vpc.getSubnetsOutput
which might be more helpful in this scenariomagnificent-lifeguard-15082
01/06/2022, 5:28 PMbillowy-army-68599
01/06/2022, 5:31 PMmagnificent-lifeguard-15082
01/06/2022, 5:34 PMvpc.id.apply(() => vpc.publicSubnets)
red-family-60032
03/28/2022, 12:14 PMconst publicSubnetsIds = vpc.id.apply(async () => vpc.getSubnetsIds("public"));
and then I use it like this:
const alb = new aws.lb.LoadBalancer(`${name}-alb`, {
internal: false,
loadBalancerType: "application",
securityGroups: [albSecGroup.id],
subnets: publicSubnetsIds.apply((ids) => ids),
});
Thanks a bunch, @magnificent-lifeguard-15082!echoing-dinner-19531
03/28/2022, 3:53 PMpublicSubnetsIds.apply((ids) => ids),
is the same as just publicSubnetsIds
red-family-60032
03/28/2022, 5:40 PMbillowy-army-68599
03/28/2022, 5:43 PMconst alb = new aws.lb.LoadBalancer(`${name}-alb`, {
internal: false,
loadBalancerType: "application",
securityGroups: [albSecGroup.id],
subnets: publicSubnetsIds
});
red-family-60032
03/28/2022, 5:45 PM