sparse-intern-71089
10/19/2021, 8:32 PMlittle-cartoon-10569
10/19/2021, 8:33 PMfresh-wire-95028
10/19/2021, 8:41 PMprivateSubnetIds[0] as an input in a clientvpn NetworkAssociationlittle-cartoon-10569
10/19/2021, 8:47 PMapply() or then(), so let's do that.little-cartoon-10569
10/19/2021, 8:48 PMsubnetId property can take an Input<string>, so we want a Promise<string> or Output<string> there.little-cartoon-10569
10/19/2021, 8:48 PMvpc.privateSubnetIds.then(subnetIds => subnetIds[0].id) returns a promise wrapping a string id.little-cartoon-10569
10/19/2021, 8:50 PMlittle-cartoon-10569
10/19/2021, 8:50 PMpulumi.output(vpc.privateSubnetIds)[0].id maybe? Haven't tried that.little-cartoon-10569
10/19/2021, 9:31 PMpulumi.output(vpc.privateSubnetIds[0]).id. I think it looks better than the then() version above.fresh-wire-95028
10/19/2021, 10:02 PMconst defaultPrivateSubnetId = pulumi
.output(vpc.privateSubnetIds)
.apply((ids) => ids[0]);
const defaultPrivateSubnetCidrBlock = pulumi
.output(vpc.privateSubnets)
.apply((subnet) => subnet[0].subnet.cidrBlock);
const networkAssociation = new aws.ec2clientvpn.NetworkAssociation(
`${name}-network-association`,
{
clientVpnEndpointId: endpoint.id,
subnetId: defaultPrivateSubnetId,
},
);
// allows the following subnet groups to access these subnets
const authorizationRule = new aws.ec2clientvpn.AuthorizationRule(
`${name}-authorization-rule`,
{
clientVpnEndpointId: endpoint.id,
targetNetworkCidr: defaultPrivateSubnetCidrBlock,
authorizeAllGroups: true,
},
);little-cartoon-10569
10/19/2021, 10:39 PMconst defaultPrivateSubnetId = pulumi.output(vpc.privateSubnetIds).apply((ids) => ids[0]);
If you do it inline (i.e., eliminate the defaultPrivateSubnetId variable), then I think that Pulumi's output promotion will handle it for you.
subnetId: pulumi.output(vpc.privateSubnetIds)[0]
Hopefully awsx will return an output version of all those promises, at some point in the future.fresh-wire-95028
10/20/2021, 7:09 PM