Skip to content

Commit

Permalink
feat(aws-ecs): expose service and target group on the LoadBalancedFar…
Browse files Browse the repository at this point in the history
…gateService (#1175)
  • Loading branch information
clareliguori authored and rix0rrr committed Nov 15, 2018
1 parent b4293f2 commit e799699
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export interface LoadBalancedFargateServiceProps {
export class LoadBalancedFargateService extends cdk.Construct {
public readonly loadBalancer: elbv2.ApplicationLoadBalancer;

public readonly targetGroup: elbv2.ApplicationTargetGroup;

public readonly service: FargateService;

constructor(parent: cdk.Construct, id: string, props: LoadBalancedFargateServiceProps) {
super(parent, id);

Expand All @@ -132,6 +136,7 @@ export class LoadBalancedFargateService extends cdk.Construct {
taskDefinition,
assignPublicIp
});
this.service = service;

const internetFacing = props.publicLoadBalancer !== undefined ? props.publicLoadBalancer : true;
const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', {
Expand All @@ -152,7 +157,7 @@ export class LoadBalancedFargateService extends cdk.Construct {
listener = lb.addListener('PublicListener', { port: 80, open: true });
}

listener.addTargets('ECS', {
this.targetGroup = listener.addTargets('ECS', {
port: 80,
targets: [service]
});
Expand Down

0 comments on commit e799699

Please sign in to comment.