the protocol type when creating a NetworkTargetGroup is hard coded to use 'Protocol.TCP'
and can not be override
https://github.com/aws/aws-cdk/blob/0f0e2055cab08551bc6e5dfb8a1b6219368263c5/packages/%40aws-cdk/aws-elasticloadbalancingv2/lib/nlb/network-target-group.ts#L60
I want to create an SSL connection between my LB and my target and need to set the Protocol to TLS
## Add the following to the NetworkTargetGroupProps
/**
* The protocol to use.
*/
readonly protocol?: Protocol;
## In the constructor for NetworkTargetGroup
constructor(scope: cdk.Construct, id: string, props: NetworkTargetGroupProps) {
super(scope, id, props, {
protocol: props.protocol != null ? props.protocol : Protocol.TCP,
port: props.port,
});
Vote. I also need this feature. Thanks.
Workaround, hope this useful for others
const targetGroup = new CfnTargetGroup(this, "custom-group", {
protocol : "TLS",
port : 443,
targets : [
{
id: config.ips[0],
port: 443
},{
id: config.ips[1],
port: 443
}
],
targetType: "ip",
vpcId : config.vpcId,
});
const networkTargetGroup = NetworkTargetGroup.fromTargetGroupAttributes(this, "network-target-group", {
targetGroupArn: targetGroup.ref
});
const listener = internalNlb.addListener('tls-listener', {
port: 443,
protocol: Protocol.TLS,
certificates: [ ListenerCertificate.fromCertificateManager(certification) ],
defaultTargetGroups: [networkTargetGroup]
});
Closed via #8525.
Most helpful comment
Workaround, hope this useful for others