Skip to content

Commit 8bafb03

Browse files
committed
add stage
1 parent 45bcdd4 commit 8bafb03

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/deploy.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ module.exports = {
9393
this.options.region)
9494
.then((result) => {
9595
const region = this.options.region || 'us-east-1';
96+
const stage = this.options.stage || 'dev';
9697
this.stateMachineArn =
97-
`arn:aws:states:${region}:${result.Account}:stateMachine:${this.options.state}`;
98+
`arn:aws:states:${region}:${result.Account}:stateMachine:${this.options.state}-${stage}`;
9899
return BbPromise.resolve();
99100
});
100101
},
@@ -156,18 +157,19 @@ module.exports = {
156157
},
157158

158159
createStateMachine() {
160+
const stage = this.options.stage || 'dev';
159161
return this.provider.request('StepFunctions',
160162
'createStateMachine',
161163
{
162164
definition: this.awsStateLanguage[this.options.state],
163-
name: this.options.state,
165+
name: `${this.options.state}-${stage}`,
164166
roleArn: this.iamRoleArn,
165167
},
166168
this.options.stage,
167169
this.options.region)
168170
.then(() => {
169171
this.serverless.cli.consoleLog('');
170-
this.serverless.cli.log(`Finish to deploy ${this.options.state} step function`);
172+
this.serverless.cli.log(`Finish to deploy ${this.options.state}-${stage} step function`);
171173
return BbPromise.resolve();
172174
}).catch((error) => {
173175
if (error.message.match(/State Machine is being deleted/)) {

0 commit comments

Comments
 (0)