File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments