# Ignore function deploy depending to environment stage

**URL:** <https://forum.serverless.com/t/ignore-function-deploy-depending-to-environment-stage/4892>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [June 28, 2018, 11:09am UTC](https://forum.serverless.com/t/ignore-function-deploy-depending-to-environment-stage/4892 "2018-06-28T11:09:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![giomarino](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@giomarino](https://forum.serverless.com/u/giomarino)\
**Post date:** [June 28, 2018, 11:09am UTC](https://forum.serverless.com/t/ignore-function-deploy-depending-to-environment-stage/4892/1 "2018-06-28T11:09:58Z")

</div>

In my serverless service I have 3 function and two stages (development, production).

> - Function A must run only in production stage
> - Function B must run for both stage
> - Function C must run only in development stage

I don’t want A is deployed in cloudformation stack for development stage and I don’t want C is deployed in production stage.

I solved partially the problem in this way for A function:

> ```
> events:
> - iot:
> name: DeviceDataReceived-r1x-${opt:stage}
> description: --
> enabled : ${opt:stage == production}
> sql: "SELECT * FROM 'devices/+/things'"
> sqlVersion: beta
> 
> ```

But it’s useless to deploy a function (and allocate all resource it needs) which will be always disabled.

---

<div class="post-metadata">

**Author:** ![jjauzion](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/jjauzion/32/7534_2.png) [@jjauzion](https://forum.serverless.com/u/jjauzion)\
**Post date:** [June 20, 2023, 2:12pm UTC](https://forum.serverless.com/t/ignore-function-deploy-depending-to-environment-stage/4892/2 "2023-06-20T14:12:14Z")

</div>

I’m having the same issue.  
Did you find a better solution than the `enabled : ${opt:stage == production}`
