All Products
Search
Document Center

Resource Orchestration Service:Fn::Equals

Last Updated:Mar 15, 2024

The built-in function Fn::Equals compares two values to check whether they are equal. If the two values are equal, true is returned. If the two values are not equal, false is returned.

Declaration

  • JSON

    {
      "Fn::Equals": [
        "value_1",
        "value_2"
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::Equals:
        - value_1
        - value_2
    • Syntax for the short form:

      !Equals [value_1, value_2]

Parameters

value: the value that you want to compare.

Return value

true or false.

Examples

In the following examples, the Fn::Equals function is used to define a condition in the Conditions section:

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

Supported functions