在我的cloudformation模板中,我有一个可以为空但带有Fn::Join的参数。假设有一个值,下面是示例:
"Parameters": {
"ConfigureRecipe": {
"Description": "Configure recipe.",
"Type": "String"
}
"Configure": [ { "Fn::Join": [ "", [ "myChefRecipe::", { "Ref": "ConfigureRecipe" } ] ] } ]如果ConfigureRecipe为空,Cloudfomation会将菜谱"myChefRecipe::“传递给OpsWorks,并在配置启动时给我一个错误,因为一个好的变量是"myChefRecipe::mysql”。我该怎么处理这件事?如果ConfigureRecipe为空,也许可以使用AWS::NoValue。
发布于 2016-09-02 11:27:27
也许你可以试试这个:
"Parameters": {
"ConfigureRecipe": {
"Description": "Configure recipe.",
"Type": "String"
}
"Conditions" : {
"CreateLayerWithoutRecipie" : {"Fn::Not" : [{"Ref" : "ConfigureRecipe"}]}
},
"Layer":{
"Type":"AWS::OpsWorks::Layer",
....
....
....
"Configure": [ "Fn::If" : [ "CreateLayerWithoutRecipie", {"Ref" : "AWS::NoValue"}, { "Fn::Join": [ "", [ "myChefRecipe::", { "Ref": "ConfigureRecipe" } ] ] } ]]
}https://stackoverflow.com/questions/38999375
复制相似问题