【发布时间】:2021-05-07 15:41:53
【问题描述】:
只有在 Env=ppd 或 Env=prod 时,我才需要在“AWS::Serverless::Function”中创建 DeadLetterQueue 属性
Conditions:
IsPpdOrPrdEnv: !Or [!Equals [!Ref "Env", ppd], !Equals [!Ref "Env", prod]]
<...>
Resources:
<...>
TestFunction:
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: !Sub '${Env}-Test-Function'
DeadLetterQueue:
TargetArn: !If [IsPpdOrPrdEnv, !Ref TestSNSTopic, !Ref "AWS::NoValue"]
Type: !If [IsPpdOrPrdEnv, SNS, !Ref "AWS::NoValue"]
<...>
错误:
转换 AWS::Serverless-2016-10-31 失败,原因是:内部转换失败。
我也试过了:
DeadLetterQueue:
!If
- IsPpdOrPrdEnv
-
TargetArn: !Ref TestSNSTopic
Type: SNS
- !Ref "AWS::NoValue"
错误:
转换 AWS::Serverless-2016-10-31 失败,原因是:无服务器应用程序规范文档无效。发现的错误数: 1. id 为 [TestFunction] 的资源无效。 'DeadLetterQueue' 需要指定 Type 和 TargetArn 属性。
有什么建议吗?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation