I need DeadLetterQueue property in 'AWS::Serverless::Function' to be created only if Env=ppd or Env=prod
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"]
<...>
The error:
Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.
I also tried:
DeadLetterQueue:
!If
- IsPpdOrPrdEnv
-
TargetArn: !Ref TestSNSTopic
Type: SNS
- !Ref "AWS::NoValue"
The error:
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.
Any advise, please?