# Serverless v3 Conditions

**URL:** https://forum.serverless.com/t/serverless-v3-conditions/18843
**Category:** Serverless Framework
**Created:** [May 8, 2023, 10:11am UTC](https://forum.serverless.com/t/serverless-v3-conditions/18843 "2023-05-08T10:11:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![GlebDmitriev](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/glebdmitriev/32/7449_2.png) [@GlebDmitriev](https://forum.serverless.com/u/GlebDmitriev)
#### Post date: [May 8, 2023, 10:11am UTC](https://forum.serverless.com/t/serverless-v3-conditions/18843/1 "2023-05-08T10:11:33Z")

</div>

We were using Serverless Framework Version 2. Now we’re switching it to the version 3. Everything works as is except for the Conditions. They’re just ignored and all the resources are trying to be created on all the environments.

Yaml code sample:

```auto
service: service-name
frameworkVersion: '3' # was '2' before

provider:
  name: aws
  runtime: provided
  stage: ${opt:stage, 'dev'}
  # some other configs here...

resources:
  Conditions:
    CreateProdResources: !Equals
      - ${self:provider.stage}
      - prod
  Resources:
    SqsQueueName:
      Type: AWS::SQS::Queue
      Condition: CreateProdResources
      Properties:
        # Some SQS properties here

```

When I switch it over to Serverless v3, my IDE starts complaining on the line: `Condition: CreateProdResources`, saying “Schema validation: Property ‘Condition’ is not allowed”.

Tried to find anything here: [Serverless Framework - Upgrading to v3](https://www.serverless.com/framework/docs/guides/upgrading-v3) - no luck. Google seems also “not aware” of the issue.

Any suggestion please?

---

<div class="post-metadata">

### Author: ![garethmcc](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/garethmcc/32/2276_2.png) [@garethmcc](https://forum.serverless.com/u/garethmcc)
#### Post date: [May 8, 2023, 10:15am UTC](https://forum.serverless.com/t/serverless-v3-conditions/18843/2 "2023-05-08T10:15:54Z")

</div>

I am not sure if this will solve the issue, but a couple of tweaks to clean things up that may, at least, make any issues more apparent:

1. Having a `stage: ${opt:stage, 'dev'}` is not necessary. That is already the default action of assigning the stage built into the framework
2. If you need to access a value for the current stage you can rather use the variable `${sls:stage}`. It is way more accurate and may be the cause of your issue. ([Serverless Framework Variables](https://www.serverless.com/framework/docs/providers/aws/guide/variables#referencing-serverless-core-variables))
3. If you are unsure of how a serverless.yml will look after all variables (such as ${sls:stage} or others) are resolved, you can run the command `serverless print` with any required region or stage flags added. This will output your serverless.yml with as many variables resolved as possible and can make debugging issues such as this much easier and faster.
