# Can't deploy production stage - Step function already exists

**URL:** <https://forum.serverless.com/t/cant-deploy-production-stage-step-function-already-exists/9072>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [August 14, 2019, 2:02pm UTC](https://forum.serverless.com/t/cant-deploy-production-stage-step-function-already-exists/9072 "2019-08-14T14:02:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craigson](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@Craigson](https://forum.serverless.com/u/Craigson)\
**Post date:** [August 14, 2019, 2:02pm UTC](https://forum.serverless.com/t/cant-deploy-production-stage-step-function-already-exists/9072/1 "2019-08-14T14:02:41Z")

</div>

Morning all, I’m attempting to separate out my stack into two versions, a “staging” and a “production” version. I’m running into a problem with the fact that I have a step function declared in my serverless.yml file, and although serverless generates different functions based on the stage, ie -${opt:stage}, my deployment fails due to a reference to Step function, like such:

```auto
resources:
  Outputs:
    MyStepFn:
      Description: The ARN of the state machine
      Value:
        Ref: MyStepFn

stepFunctions:
  stateMachines:
    myNewStepFunction:
      name: 'MyStepFn-${opt:stage}'
      definition:
        Comment: 'Using Amazon State Language to generate a state machine for processing images'
        StartAt: InitialState

```

It basically won’t let me deploy a different stage because it says the step function already exists, how do I get it to create a second step function based on the ${opt:stage}

How do I go about achieving this? Ie. how to I configure the serverless.yml file to generate two separate step functions?
