我正在使用平台条件来控制在AWS上运行的环境类型.有很多共享资源,但我需要某些EC2实例与预先制作的AMI,具体取决于数量条件.
"Parameters": {
"Platform": {
"Description": "Select platform type - linux or windows",
"Default": "linux",
"Type": "String",
"AllowedValues": [ "linux", "windows", "both" ],
"ConstraintDescription": "Must enter either linux, windows, or both"
},
Run Code Online (Sandbox Code Playgroud)
然后我设置了conditions.
"Conditions" : {
"LinuxPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "linux"]},
"WindowsPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "windows"]},
"BothPlatform" : {"Fn::Equals" : [{"Ref" : "Platform"}, "both"]}
},
Run Code Online (Sandbox Code Playgroud)
在资源中,我想使用linux或windows来触发Windows或Linux Ec2创建,或者使用它们来部署所声明的每个ec2资源.
我fn:or在几个方面尝试了以下使用方法.
"Fn::Or": [{"Condition": "LinuxPlatform"}, {"Condition": "BothPlatform" }],
和...
"Condition" : {
"Fn::Or" : …Run Code Online (Sandbox Code Playgroud)