Skip to content

Conversation

icarus-sullivan
Copy link

@icarus-sullivan icarus-sullivan commented Jun 5, 2017

Allow users to provide their own stepMachine naming convention.

example

functions:
  hello:
    handler: handler.hello

stepFunctions:
  stateMachines:
    hellostepfunc:
      Name: hellostepfunc-${opt:stage}
      definition:
        <your definition>

plugins:
  - serverless-step-functions

@coveralls
Copy link

coveralls commented Jun 5, 2017

Coverage Status

Coverage decreased (-0.9%) to 99.091% when pulling 0bc038d on icarus-sullivan:CustomNaming into 076e8e6 on horike37:master.

@coveralls
Copy link

coveralls commented Jun 5, 2017

Coverage Status

Coverage decreased (-0.9%) to 99.091% when pulling 08249b0 on icarus-sullivan:CustomNaming into 076e8e6 on horike37:master.

@coveralls
Copy link

coveralls commented Jun 5, 2017

Coverage Status

Coverage decreased (-0.9%) to 99.091% when pulling b1a3025 on icarus-sullivan:CustomNaming into 076e8e6 on horike37:master.

@coveralls
Copy link

coveralls commented Jun 6, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling e92203b on icarus-sullivan:CustomNaming into 076e8e6 on horike37:master.

@icarus-sullivan
Copy link
Author

Sorry it took a while to get the lint/tests necessary updates.

@justinmchase
Copy link

First off 👏

A few questions though:

In your example code above you have this line:

statemachine_arn: ${self:resources.Outputs.HelloStepfunc.Value}

But you have omitted the Resources->Outputs section from the example. Was that just an oversight or does this PR automatically add step function arns to outputs as well?

Also, for your name you have Name: hellostepfunc-${opt:stage} but the actual name/arn will still have the random string attached correct?

e.g.

hellostepfunc-prod-QWUYMJP6O0QH

@justinmchase
Copy link

I would recommend adding this field to the main Readme.md also:

https://github.com/horike37/serverless-step-functions/blob/master/README.md#setup

Maybe also update the Tips example at the bottom.

@icarus-sullivan
Copy link
Author

icarus-sullivan commented Jun 6, 2017

** I'm on mobile at the moment so my answer may be short and have spelling errors.

The leftover step_function environment variable was a copy and paste from an example on these threads. However it will still work even with a custom name.

Docs: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html

Looks like the following will find the stepFunction and ignore the trailing characters.

{ "Fn::GetAtt": ["MyStateMachine", "Name"] }

@coveralls
Copy link

coveralls commented Jun 6, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 18aba0f on icarus-sullivan:CustomNaming into 076e8e6 on horike37:master.

@horike37
Copy link
Collaborator

horike37 commented Jun 8, 2017

Suuuuuuper Cool @icarus-sullivan!!!
Thank you for sending this PR!! This looks good!
I didn't come up with this approach.

I will test it locally. However I am busy in this week, please give me a little time.

@horike37 horike37 merged commit 8b94d46 into serverless-operations:master Jun 12, 2017
@horike37
Copy link
Collaborator

Thank you for this @icarus-sullivan !
I have tested locally and work it correctly! LGTM.
merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants