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

fix(ecs-patterns): Revert listener protocol and port being passed to target group #4988

Merged
merged 1 commit into from
Nov 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export interface ApplicationLoadBalancedServiceBaseProps {
/**
* Listener port of the application load balancer that will serve traffic to the service.
*
* @default 80
* @default - The default listener port is determined from the protocol (port 80 for HTTP,
* port 443 for HTTPS). A domain name and zone must be also be specified if using HTTPS.
*/
readonly listenerPort?: number;

Expand Down Expand Up @@ -286,8 +287,7 @@ export abstract class ApplicationLoadBalancedServiceBase extends cdk.Construct {
const protocol = props.protocol !== undefined ? props.protocol : (props.certificate ? ApplicationProtocol.HTTPS : ApplicationProtocol.HTTP);

const targetProps = {
port: props.listenerPort !== undefined ? props.listenerPort : 80,
protocol
port: 80
};

this.listener = this.loadBalancer.addListener('PublicListener', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export abstract class NetworkLoadBalancedServiceBase extends cdk.Construct {
const listenerPort = props.listenerPort !== undefined ? props.listenerPort : 80;

const targetProps = {
port: listenerPort
port: 80
};

this.listener = this.loadBalancer.addListener('PublicListener', { port: listenerPort });
Expand Down
9 changes: 9 additions & 0 deletions packages/@aws-cdk/aws-ecs-patterns/test/ec2/test.l3s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,15 @@ export = {
}]
}));

expect(stack).to(haveResource('AWS::ElasticLoadBalancingV2::TargetGroup', {
Port: 80,
Protocol: 'HTTP',
TargetType: "ip",
VpcId: {
Ref: "VPCB9E5F0B4"
}
}));

expect(stack).to(haveResource("AWS::ECS::Service", {
DesiredCount: 1,
LaunchType: "FARGATE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
"FargateNlbServiceLBPublicListenerECSGroup7501571D": {
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
"Properties": {
"Port": 2015,
"Port": 80,
"Protocol": "TCP",
"TargetType": "ip",
"VpcId": {
Expand Down Expand Up @@ -667,7 +667,7 @@
"FargateAlbServiceLBPublicListenerECSGroupB3826700": {
"Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
"Properties": {
"Port": 2015,
"Port": 80,
"Protocol": "HTTP",
"TargetType": "ip",
"VpcId": {
Expand Down