Skip to content

[ecs-patterns; ApplicationLoadBalancedFargateService] When attaching certificate, target group protocol set to that of listener protocol #4983

@kevin-lindsay-1

Description

@kevin-lindsay-1

As of aws-cdk/aws-ecs-patterns@1.16.0, specifying an ApplicationLoadBalancedFargateService like so:

...
const lbfs = new ApplicationLoadBalancedFargateService(this, 'LBFS', {
    serviceName: ccFqAppName,
    cluster,
    taskImageOptions: {
      image,
      environment: {
        STAGE: appStage,
      },
    },
    domainZone,
    domainName,
    certificate,
  });
  lbfs.targetGroup.configureHealthCheck({
    path: '/.well-known/apollo/server-health',
  });

outputs:

...
"ServiceLBFSLBPublicListenerECSGroup46113E88": {
      "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
      "Properties": {
        "HealthCheckPath": "/.well-known/apollo/server-health",
        "Port": 80,
        "Protocol": "HTTPS",
        "TargetType": "ip",
        "VpcId": {
          "Ref": "ServiceVpc4872DC6E"
        }
      },
      "Metadata": {
        "aws:cdk:path": "standalone/Service/LBFS/LB/PublicListener/ECSGroup/Resource"
      }
    },
...

whereas on 1.15.x, it outputs:

...
"ServiceLBFSLBPublicListenerECSGroup46113E88": {
      "Type": "AWS::ElasticLoadBalancingV2::TargetGroup",
      "Properties": {
        "HealthCheckPath": "/.well-known/apollo/server-health",
        "Port": 80,
        "Protocol": "HTTP",
        "TargetType": "ip",
        "VpcId": {
          "Ref": "ServiceVpc4872DC6E"
        }
      },
      "Metadata": {
        "aws:cdk:path": "standalone/Service/LBFS/LB/PublicListener/ECSGroup/Resource"
      }
    },
...

This appears to be causing 502s on the ECS service, and I don't see a way to manually override it in 1.16.x

Reproduction Steps

Error Log

Environment

  • CLI Version :
  • Framework Version:
  • OS :
  • Language :

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-ecs-patternsRelated to ecs-patterns librarybugThis issue is a bug.in-progressThis issue is being actively worked on.p0

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions