💾 Archived View for cfdocs.wetterberg.nu › intrinsic-function-reference-condition.gemini captured on 2023-11-04 at 12:33:54. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

Condition

Search

The intrinsic function `Condition` returns the evaluated result of the specified *condition*.

When you are declaring a condition in a template and you need to use another condition in the evaluation, you can use `Condition` to refer to that other condition. This is used when declaring a condition in the Conditions section of the template.

Conditions

Declaration

JSON

{ "Condition" : "conditionName" }

YAML

Syntax for the full function name:

Condition: conditionName

Syntax for the short function name:

!Condition conditionName

Parameters

`conditionName`

The name of the condition you want to reference.

Return Value

The boolean result of the condition referenced.

Example

The following snippet is from the `Conditions` section of a template. The `MyAndCondition` condition includes the `SomeOtherCondition` condition:

JSON

"MyAndCondition": {
   "Fn::And": [
      {"Fn::Equals": ["sg-mysggroup", {"Ref": "ASecurityGroup"}]},
      {"Condition": "SomeOtherCondition"}
   ]
}

YAML

MyAndCondition: !And
  - !Equals ["sg-mysggroup", !Ref "ASecurityGroup"]
  - !Condition SomeOtherCondition

Supported functions

You cannot use any functions in the `Condition` function. You must specify a string that is a condition name.