From e7543a7ff393cde31af9e022fc341b625e0cc62c Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Mon, 27 May 2019 16:23:20 +0200 Subject: [PATCH 1/2] fic(ecs): fix `fromClusterAttributes` Remove unnecessary import. Fixes #2631. --- packages/@aws-cdk/aws-ecs/lib/cluster.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@aws-cdk/aws-ecs/lib/cluster.ts b/packages/@aws-cdk/aws-ecs/lib/cluster.ts index 5e014566208dc..c8b04d69b40d2 100644 --- a/packages/@aws-cdk/aws-ecs/lib/cluster.ts +++ b/packages/@aws-cdk/aws-ecs/lib/cluster.ts @@ -394,7 +394,7 @@ class ImportedCluster extends Construct implements ICluster { constructor(scope: Construct, id: string, props: ClusterAttributes) { super(scope, id); this.clusterName = props.clusterName; - this.vpc = ec2.Vpc.fromVpcAttributes(this, "vpc", props.vpc); + this.vpc = props.vpc; this.hasEc2Capacity = props.hasEc2Capacity !== false; this._defaultNamespace = props.defaultNamespace; From 4f5760ccf0574bd3775397db6c9c39db03dfb501 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Tue, 28 May 2019 15:05:13 +0200 Subject: [PATCH 2/2] Surface test to reproduce failing case --- packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts b/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts index ff754f5ca5154..498aacdd1fcb8 100644 --- a/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts +++ b/packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts @@ -364,6 +364,9 @@ export = { test.equal(cluster2.defaultNamespace!.type, cloudmap.NamespaceType.DnsPrivate); test.deepEqual(stack2.node.resolve(cluster2.defaultNamespace!.namespaceId), 'import-namespace-id'); + // Can retrieve subnets from VPC - will throw 'There are no 'Private' subnets in this VPC. Use a different VPC subnet selection.' if broken. + cluster2.vpc.selectSubnets(); + test.done(); } };