Description
Replaces this issue created by Doug-AWS on Mar 11 in the CDK repo: aws/aws-cdk#1990.
Original description:
User wrote:
I'm trying to get a subnetId with a tag (actually the tag is applied by creation through CDK, so it's especially troublesome to not be able to find this).
In this example, you show how to apply a tag, but not how to find a resource with a Tag. Presently, I need to replace something like the following in the AWS SDK:
Filter filter = new Filter().withName("vpc-id").withValues(vpcId).withName("tag:Name").withValues("infraStack/CodeBuild VPC/PrivateSubnet1");
DescribeSubnetsRequest describeSubnetsRequest = new DescribeSubnetsRequest().withFilters(filter);
String subnetId = null;
try {
subnetId = getClient().describeSubnets(describeSubnetsRequest).getSubnets().iterator().next().getSubnetId();
Right now CDK doesn't necessarily have API or user guide documentation on how to do this--or I'm not finding it.