AWS CloudFormation Concepts Condition Functions: Difference between revisions
Jump to navigation
Jump to search
(11 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
=Overview= | =Overview= | ||
As it is the case for [[AWS_CloudFormation_Concepts_Intrinsic_Functions#Overview|intrinsic functions]], condition functions have a full function name, and a short form. For more details see: | |||
{{Internal|AWS_CloudFormation_Concepts_Intrinsic_Functions#Overview|Intrinsic Functions - Overview}} | |||
=Fn::If: !If= | =Fn::If: !If= | ||
=Fn::And: | <font color=darkgray> | ||
=Fn::Equals: | Fn::If: function can be used to conditionally specify a property. | ||
=Fn::Not:, !Not | |||
=Fn::Or: | Fn::If is only supported in the metadata attribute, update policy attribute, and property values in the Resources section and Outputs sections of a template. | ||
</font> | |||
=Fn::And: !And= | |||
=Fn::Equals: !Equals= | |||
!Equals ['something', !Ref SomethingElse] | |||
=Fn::Not: !Not= | |||
For YAML syntax reasons, it's best to leave spaces around [ and ]. | |||
Conditions: | |||
SomeCondition: | |||
Fn::Not: [ !Equals [ 'blue', !Ref SomeParameter ] ] | |||
Conditions: | |||
SomeCondition: | |||
!Not [ !Equals [ 'blue', !Ref SomeParameter ] ] | |||
=Fn::Or: !Or= | |||
=Expressions= | |||
Expressions can use [[AWS_CloudFormation_Concepts#Pseudo-Parameters|pseudo-parameters]], [[AWS_CloudFormation_Concepts#Input_Parameters_.28Template_Parameters.29|template input parameters]] and [[AWS_CloudFormation_Concepts#Mappings|mappings]]. Expressions are useful when declaring [[AWS_CloudFormation_Concepts#Conditions|Conditions]]. Other conditions can be referenced within conditions. |
Latest revision as of 19:12, 18 April 2019
External
Internal
Overview
As it is the case for intrinsic functions, condition functions have a full function name, and a short form. For more details see:
Fn::If: !If
Fn::If: function can be used to conditionally specify a property.
Fn::If is only supported in the metadata attribute, update policy attribute, and property values in the Resources section and Outputs sections of a template.
Fn::And: !And
Fn::Equals: !Equals
!Equals ['something', !Ref SomethingElse]
Fn::Not: !Not
For YAML syntax reasons, it's best to leave spaces around [ and ].
Conditions: SomeCondition: Fn::Not: [ !Equals [ 'blue', !Ref SomeParameter ] ]
Conditions: SomeCondition: !Not [ !Equals [ 'blue', !Ref SomeParameter ] ]
Fn::Or: !Or
Expressions
Expressions can use pseudo-parameters, template input parameters and mappings. Expressions are useful when declaring Conditions. Other conditions can be referenced within conditions.