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.
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 can't use any functions in the Condition
function. You must specify a
string that's a condition name.