# How to conditionally render a Lambda Function, only to prd stage

**URL:** <https://forum.serverless.com/t/how-to-conditionally-render-a-lambda-function-only-to-prd-stage/15881>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [September 5, 2021, 2:32pm UTC](https://forum.serverless.com/t/how-to-conditionally-render-a-lambda-function-only-to-prd-stage/15881 "2021-09-05T14:32:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![afuentes](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@afuentes](https://forum.serverless.com/u/afuentes)\
**Post date:** [September 5, 2021, 2:32pm UTC](https://forum.serverless.com/t/how-to-conditionally-render-a-lambda-function-only-to-prd-stage/15881/1 "2021-09-05T14:32:23Z")

</div>

Hello, thank you for taking the time to read this post. I’m trying to render an AWS Lambda Function conditionally, based on stage (only for “prd” stage).

This lambda has a Role, which renders conditionally too. I already achieved this by using cloudformation conditions on the resources block.

However, I don’t know how to make it work for the lambda function, as it is in the functions block I don’t have idea how to reference the condition. From the [serverless.yml reference](https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/) I decided to do what is shown below, and it doesn’t work:

![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/8/8ba75dbda499046f651a45d962639d4f9140ec09.png)

Can someone help me to understand what am I doing wrong? And also what would be the solution to make this work? Thanks in advance
