Skip to content

Commit 5d8d417

Browse files
authored
Merge pull request #324 from CM-Kajiwara/no-output-option
feat: not output cloudformation outputs section
2 parents 5e48333 + d4987cb commit 5d8d417

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,15 @@ stepFunctions:
351351
validate: true
352352
```
353353

354+
### Disable Output Cloudformation Outputs section
355+
356+
Disables output in the CloudFormation Outputs section. if you define many state-machines in serverless.yml, there is a possibility of reaching out a CloudFormation limits in which the maximum number of outputs is 60. If you define `noOutput: true`, you can prevent automatically output by this plugin.
357+
358+
```yaml
359+
stepFUnctions:
360+
noOutput: true
361+
```
362+
354363
### Express Workflow
355364

356365
At re:invent 2019, AWS [introduced Express Workflows](https://aws.amazon.com/about-aws/whats-new/2019/12/introducing-aws-step-functions-express-workflows/) as a cheaper, more scalable alternative (but with a cut-down set of features). See [this page](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html) for differences between standard and express workflows.

lib/deploy/stepFunctions/compileStateMachines.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,10 @@ module.exports = {
243243
[stateMachineOutputLogicalId]: stateMachineOutPutObject,
244244
};
245245

246-
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Outputs,
247-
newStateMachineOutPutObject);
246+
if (this.serverless.service.stepFunctions.noOutput !== true) {
247+
_.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Outputs,
248+
newStateMachineOutPutObject);
249+
}
248250

249251
return BbPromise.resolve();
250252
});

lib/deploy/stepFunctions/compileStateMachines.test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,4 +1390,44 @@ describe('#compileStateMachines', () => {
13901390
},
13911391
});
13921392
});
1393+
1394+
it('should output cloudformation outputs section', () => {
1395+
serverless.service.stepFunctions = {
1396+
stateMachines: {
1397+
myStateMachine1: {
1398+
definition: 'definition1',
1399+
role: 'arn:aws:role1',
1400+
},
1401+
myStateMachine2: {
1402+
name: 'stateMachineBeta2',
1403+
definition: 'definition2',
1404+
role: 'arn:aws:role2',
1405+
},
1406+
},
1407+
noOutput: false,
1408+
};
1409+
serverlessStepFunctions.compileStateMachines();
1410+
expect(Object.keys(serverlessStepFunctions.serverless.service.provider
1411+
.compiledCloudFormationTemplate.Outputs).length).to.equal(2);
1412+
});
1413+
1414+
it('should not output cloudformation outputs section', () => {
1415+
serverless.service.stepFunctions = {
1416+
stateMachines: {
1417+
myStateMachine1: {
1418+
definition: 'definition1',
1419+
role: 'arn:aws:role1',
1420+
},
1421+
myStateMachine2: {
1422+
name: 'stateMachineBeta2',
1423+
definition: 'definition2',
1424+
role: 'arn:aws:role2',
1425+
},
1426+
},
1427+
noOutput: true,
1428+
};
1429+
serverlessStepFunctions.compileStateMachines();
1430+
expect(Object.keys(serverlessStepFunctions.serverless.service.provider
1431+
.compiledCloudFormationTemplate.Outputs).length).to.equal(0);
1432+
});
13931433
});

lib/yamlParser.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
.then((parsedObject) => {
2828
this.serverless.service.stepFunctions = {
2929
validate: parsedObject.stepFunctions ? parsedObject.stepFunctions.validate : false,
30+
noOutput: parsedObject.stepFunctions ? parsedObject.stepFunctions.noOutput : false,
3031
};
3132
this.serverless.service.stepFunctions.stateMachines = parsedObject.stepFunctions
3233
&& parsedObject.stepFunctions.stateMachines

0 commit comments

Comments
 (0)