I have created an AWS VPC using the terraform-aws-modules/vpc/aws
module. Specifically, I’m using the high-level Vpc
class.
In a separate cdktf deployment, I am creating a Lambda function. I want to assign the lambda function to specific subnets of the VPC created previously.
How can I retrieve the private subnet ids from the existing VPC? I’ve looked at the DataAwsSubnetIds
class, but I don’t know how to filter the only the private subnets. The subnet name (i.e., tag) is of the form: <vpc-name>-private-<region><az>
.
I’m starting to suspect that I will need to recreate the VPC using the lower-level resources so that I can tag the individual subnets in a way that I am able to retrieve them.
I’m hoping there is a way in my cdktf code to actually retrieve and use python to filter to the subnets I’m interested in.
Any ideas?