All Products
Search
Document Center

Resource Orchestration Service:Fn::Or

Last Updated:Jun 17, 2026

Fn::Or evaluates two or more conditions and returns true if any condition is true, or false if all conditions are false.

Declaration

  • JSON

    {
      "Fn::Or": [
        "condition1",
        "condition2",
        ...
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::Or:
        - condition1
        - condition2
        - ...
    • Syntax for the short form:

      !Or [condition1, condition2, ...]

Parameters

condition: a condition to evaluate.

Return value

true or false.

Examples

Fn::Or can define a condition only in the Conditions or Rules section.

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EnvType:
    Type: String
    Default: pre
Conditions:
  TestEqualsCond:
    !Equals
      - prod
      - !Ref EnvType
  TestOrCond:
    !Or
      - TestEqualsCond
      - !Equals
          - pre
          - !Ref EnvType
{
  "Parameters": {
    "EnvType": {
      "Default": "pre",
      "Type": "String"
    }
  },
  "Conditions": {
    "TestEqualsCond": {
      "Fn::Equals": [
        "prod",
        {"Ref": "EnvType"}
      ]
    },
    "TestAndCond": {
      "Fn::Or": [
        "TestEqualsCond",
        {
          "Fn::Equals": [
            "pre",
            {"Ref": "EnvType"}
          ]
        }
      ]
    }
  }
}

Supported functions