serverless-fargate-tasks
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -38,6 +38,3 @@ 'use strict'; | ||
Object.keys(options.tasks).forEach(identifier => { | ||
var name = this.provider.naming.normalizeNameToAlphaNumericOnly(identifier); | ||
if (debug) consoleLog(yellow('Processing ' + identifier)); | ||
// consoleLog(identifier); | ||
// consoleLog(name); | ||
// consoleLog(options.tasks[identifier]); | ||
@@ -52,2 +49,5 @@ | ||
var name = options.tasks[identifier]['name'] || identifier | ||
var normalizedIdentifier = this.provider.naming.normalizeNameToAlphaNumericOnly(identifier) | ||
// consoleLog(override); | ||
@@ -89,3 +89,3 @@ if (!override.hasOwnProperty('role')) { | ||
var definitions = Object.assign({ | ||
'Name': identifier, | ||
'Name': name, | ||
'Image': options.tasks[identifier]['image'], | ||
@@ -108,3 +108,3 @@ 'Environment': environment, | ||
'ContainerDefinitions': [definitions], | ||
'Family': identifier, | ||
'Family': name, | ||
'NetworkMode': 'awsvpc', | ||
@@ -118,3 +118,3 @@ 'ExecutionRoleArn': options['role'] || {"Fn::Sub": 'arn:aws:iam::${AWS::AccountId}:role/ecsTaskExecutionRole'}, | ||
} | ||
template['Resources'][name + 'Task'] = task | ||
template['Resources'][normalizedIdentifier + 'Task'] = task | ||
@@ -129,5 +129,5 @@ let desired = options.tasks[identifier]['desired'] | ||
'LaunchType': 'FARGATE', | ||
'ServiceName': identifier, | ||
'ServiceName': name, | ||
'DesiredCount': desired == undefined ? 1 : desired, | ||
'TaskDefinition': {"Fn::Sub": '${' + name + 'Task}'}, | ||
'TaskDefinition': {"Fn::Sub": '${' + normalizedIdentifier + 'Task}'}, | ||
'NetworkConfiguration': { | ||
@@ -142,3 +142,3 @@ 'AwsvpcConfiguration': Object.assign({ | ||
} | ||
template['Resources'][name + 'Service'] = service | ||
template['Resources'][normalizedIdentifier + 'Service'] = service | ||
}); | ||
@@ -145,0 +145,0 @@ |
@@ -17,3 +17,3 @@ { | ||
}, | ||
"version": "0.2.0" | ||
"version": "0.3.0" | ||
} |
@@ -45,2 +45,3 @@ Serverless Fargate Tasks | ||
my-task: | ||
name: ${self:service}-${self:provider.stage}-my-task # default name is be the object key (here 'my-task') | ||
image: 123456789369.dkr.ecr.eu-west-1.amazonaws.com/my-image | ||
@@ -47,0 +48,0 @@ environment: # optional |
8562
78
129