Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fic(ecs): fix fromClusterAttributes #2649

Merged
merged 2 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did fromVpcAttributes accept IVpc? Structural typing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep.

this.vpc = props.vpc;
this.hasEc2Capacity = props.hasEc2Capacity !== false;
this._defaultNamespace = props.defaultNamespace;

Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-ecs/test/test.ecs-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};