From 9065c543e154b5a9dafb75f241bd6af6fa88866f Mon Sep 17 00:00:00 2001 From: Taichiro Suzuki Date: Wed, 1 Oct 2025 12:33:16 +0900 Subject: [PATCH] fix --- .../lib/construct/closedNetwork/resolver.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/cdk/lib/construct/closedNetwork/resolver.ts b/packages/cdk/lib/construct/closedNetwork/resolver.ts index fb0e837c2..1ba631dd5 100644 --- a/packages/cdk/lib/construct/closedNetwork/resolver.ts +++ b/packages/cdk/lib/construct/closedNetwork/resolver.ts @@ -5,7 +5,7 @@ import { SecurityGroup, ISubnet, SubnetType, - SubnetFilter, + Subnet, } from 'aws-cdk-lib/aws-ec2'; import { CfnResolverEndpoint } from 'aws-cdk-lib/aws-route53resolver'; import { Construct } from 'constructs'; @@ -41,15 +41,13 @@ export class Resolver extends Construct { 'DNS UDP' ); - const subnets = props.vpc.selectSubnets( - props.subnetIds - ? { - subnetFilters: [SubnetFilter.byIds(props.subnetIds)], - } - : { - subnetType: SubnetType.PRIVATE_ISOLATED, - } - ).subnets; + const subnets = props.subnetIds + ? props.subnetIds.map((subnetId) => + Subnet.fromSubnetId(this, `ResolverSubnet-${subnetId}`, subnetId) + ) + : props.vpc.selectSubnets({ + subnetType: SubnetType.PRIVATE_ISOLATED, + }).subnets; const ipAddresses: CfnResolverEndpoint.IpAddressRequestProperty[] = subnets.map((s: ISubnet) => ({ subnetId: s.subnetId }));