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

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 I decided to do what is shown below, and it doesn’t work:

image

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