文档

Fn::Not

更新时间:

调用内部函数Fn::Not代表NOT运算符。对计算为false的条件,返回true;对计算为true的条件,返回false。

函数声明

  • JSON

    {
     "Fn::Not": "condition"
    }
  • YAML

    • 完整函数的语法。

      Fn::Not: condition
    • 缩写形式。

      !Not condition

参数信息

condition:计算为true或false的条件。

返回值

true或false。

使用示例

在Conditions中使用Fn::Not定义一个条件。

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

支持的函数

  • 本页导读 (1)
文档反馈