sparse-winter-82360
06/14/2024, 1:18 PMawsx.vpc
resource to create a VPC, but I now need to add a peering connection.
What’s the best way to update my route tables? I’m not finding an option inside the awsx.Vpc
resource.
Do I need to switch to manually creating the resources with aws.ec2.Vpc
, aws.ec2.Subnet
aws.ec2.RouteTable
, etc or is there a better approach that I’m missing?little-cartoon-10569
06/16/2024, 11:19 PMPromise.all([this.vpc.publicSubnets, this.vpc.privateSubnets]).then(([publicSubnets, privateSubnets]) => {
[...publicSubnets, ...privateSubnets].forEach((subnet) => {
subnet.createRoute(
`peering-to-${label}`,
{
vpcPeeringConnectionId: this.peerConnectionId,
destinationCidrBlock: cidrBlock
},
this.parentOpts(subnet)
);
});
});
This code was written before the various ...Output
methods existed. If they exist for awsx.Vpc, then you can use apply()
instead of then()
.sparse-winter-82360
06/17/2024, 6:39 AMvpc.routeTables.apply(routeTables => {
for (const [index, routeTable] of routeTables.entries()) {
routeTable.tags.apply(tags => {
if (tags?.SubnetType === 'Private' || tags?.Name?.includes('private')) {
const route = new aws.ec2.Route(...);
}
});
}
});
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by