我正在尝试更新我的cf堆栈,在部署时遇到以下错误:"属性AlarmActions的值必须是字符串列表类型">
这是属性AlarmActions:
AlarmActions:
- !Ref SparksTeamSNSTopic
- !If
- CreateProdResources
- - !Ref SparksProdAlarmSNSTopic
- !ImportValue
'Fn::Sub': '${Environment}-BMCMajorAlarmTopic'
- - !Ref 'AWS::NoValue'
根据AWS文档,AlarmActions
属性必须包含值,作为字符串列表。因此,如果它是JSON:,您应该有这样的东西
"AlarmActions":[
{"Ref":"ARN of something"},
{"Ref":"ARN of something"}
]
但既然你已经使用了YAML,你应该有这样的东西:
AlarmActions:
- !Split [",", !Ref SparksTeamSNSTopic] <-- make sure SparksTeamSNSTopic contains a list of strings; hence this will split it by comma
您可以将SparksTeamSNSTopic
定义为
"SparksTeamSNSTopic" : ["topicarn1", "topicarn2"]
试试这个,
AlarmActions:
- !Ref SparksTeamSNSTopic
- !If
- CreateProdResources
- - !Ref SparksProdAlarmSNSTopic
- !ImportValue
'Fn::Sub': '${Environment}-BMCMajorAlarmTopic'
- !Ref 'AWS::NoValue'