Skip to content

Commit f17ae31

Browse files
authored
Merge pull request #6 from RoundingWellOS/fix/updateServiceLBs
Actually update service load balancers
2 parents ac80b64 + 1cee6bb commit f17ae31

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/index.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,19 @@ class ServerlessFargateTasks {
8989
'awslogs-stream-prefix': 'fargate'
9090
},
9191
},
92-
}, container_override)
92+
}, container_override);
93+
94+
if(options.tasks[identifier].hasOwnProperty('loadBalancers')) {
95+
let portMappings= [];
96+
options.tasks[identifier]['loadBalancers'].forEach(item => {
97+
const portMapping = {
98+
'ContainerPort': item.containerPort,
99+
'HostPort': item.hostPort
100+
};
101+
portMappings.push(portMapping);
102+
});
103+
definitions['PortMappings'] = portMappings;
104+
}
93105

94106
// create the task definition
95107
var task = {
@@ -165,11 +177,12 @@ class ServerlessFargateTasks {
165177
options.tasks[identifier]['loadBalancers'].forEach(item => {
166178
const loadBalancer = Object.assign({
167179
'ContainerName': name,
168-
'ContainerPort': item.port,
180+
'ContainerPort': item.containerPort,
169181
'TargetGroupArn': item.arn
170182
});
171183
loadBalancers.push(loadBalancer);
172184
});
185+
service['Properties']['LoadBalancers'] = loadBalancers;
173186
}
174187
template['Resources'][normalizedIdentifier + 'Service'] = service
175188
}

0 commit comments

Comments
 (0)