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

feat(aws-ec2): can now use PrefixList in ingress rules #1360

Merged
merged 1 commit into from
Dec 14, 2018
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
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ec2/lib/security-group-rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class AnyIPv6 extends CidrIPv6 {
* https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html
*/
export class PrefixList implements ISecurityGroupRule, IConnectable {
public readonly canInlineRule = true;
public readonly canInlineRule = false;
public readonly connections: Connections = new Connections({ securityGroupRule: this });
public readonly uniqueId: string;

Expand All @@ -114,7 +114,7 @@ export class PrefixList implements ISecurityGroupRule, IConnectable {
}

public toIngressRuleJSON(): any {
throw new Error('Prefix lists can only be used for egress rules');
return { sourcePrefixListId: this.prefixListId };
}

public toEgressRuleJSON(): any {
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-ec2/test/test.security-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export = {
for (const peer of peers) {
for (const port of ports) {
sg.connections.allowTo(peer, port);
sg.connections.allowFrom(peer, port);
}
}

Expand Down