Open dpwrussell opened 6 years ago
I've since been pointed at this gotcha, but that can not resolve the use case described because the parameters can contain dashes or underscores themselves. I guess it is possible to always insert a custom and static string at the start to resolve the upper case letter transformation though.
In general though, I don't think that renaming the key name and output using the property designed for StateMachineName
makes sense.
How did you solve the issue?
Any update
My solution was to add a custom logical id for the stateMachine.
This is a (Feature Proposal)
Description
When using a custom
name
in the definition of a step function in serverless, this is obviously intended to populate theStateMachineName
property. It does that sucessfullyIt has the unfortunate side-effect of also changing the resource key name used in the cloudformation template. This is not desirable as it makes it impossible to reference the newly created step function in a
resources
block because the name will be transformed. I can not think of any advantage in changing the resource key name to this value.For example, take this partial example:
Where
STACK_PREFIX="test-1"
andSTAGE="dev"
. The resulting name istest-1-dev-MyStepFunction
which is exactly what I wantStateMachineName
to be set to. However this causes the cloudformation template to look like this:Note the capitalisation of the first letter and the replacement of the dashes with "Dash". If I then wish to reference this step function in my
resources
block I can usually use the known pattern that is used to create the cloudformation key names, so I can reference them, but in this case I can't, because it is a transformation of the name property I supplied.A
Ref
that would work isTestDash1DashdevDashMyStepFunction
, but as far as I know there is no way to (within the serverless template) access the mechanism to transformtest-1-dev-MyStepFunction
into this.As there is no advantage to renaming the key name (as it's entirely internal to the template and it already has a well defined way to define its own key name), I suggest simply leaving it as it would have been if
name
had never been specified:MyStepFunctionStepFunctionsStateMachine
.Additional Data