gpt4 book ai didi

amazon-web-services - CloudFormation 可选映射属性 - DeadLetterQueue

转载 作者:行者123 更新时间:2023-12-03 07:15:25 25 4
gpt4 key购买 nike

仅当 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"]
<...>

错误:

Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.

我也尝试过:

     DeadLetterQueue: 
!If
- IsPpdOrPrdEnv
-
TargetArn: !Ref TestSNSTopic
Type: SNS
- !Ref "AWS::NoValue"

错误:

Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [TestFunction] is invalid. 'DeadLetterQueue' requires Type and TargetArn properties to be specified.

请问有什么建议吗?

最佳答案

这似乎是 SAM 的错误/限制。 github 中存在 Unresolved 问题( herehere ),它们描述了您所遇到的情况。

由于这两个问题都尚未解决,因此它们尚未解决。提供的唯一解决方法是:

We ended up needing to add a (manual or scripted) pre-deploy step that just removes the entire [DeadLetterQueue] config part if a [DeadLetterQueue] isn't desired.

关于amazon-web-services - CloudFormation 可选映射属性 - DeadLetterQueue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66027001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com