From f4817b1e728a467b4c9e5112676c9ae23732c9a0 Mon Sep 17 00:00:00 2001 From: Rico Huijbers Date: Tue, 28 May 2019 16:35:02 +0200 Subject: [PATCH] fic(ecs): fix `fromClusterAttributes` (#2649) Remove unnecessary import call. Fixes #2631. --- packages/@aws-cdk/aws-ecs/lib/cluster.ts | 2 +- packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts | 3 +++ 2 files changed, 4 insertions(+), 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; 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 286896eb7b774..922a01bcbc783 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(); } };