title: CloudFormation Optional Map Property - DeadLetterQueue
body: <p>I need DeadLetterQueue property in 'AWS::Serverless::Function' to be created only if Env=ppd or Env=prod</p>
  <pre class="lang-yaml prettyprint-override"><code>Conditions:
    IsPpdOrPrdEnv: !Or [!Equals [!Ref &quot;Env&quot;, ppd], !Equals [!Ref &quot;Env&quot;, prod]]
  &lt;...&gt;
  Resources:
    &lt;...&gt;
    TestFunction:
      Type: 'AWS::Serverless::Function'
      Properties:
        FunctionName: !Sub '${Env}-Test-Function'
        DeadLetterQueue: 
          TargetArn: !If [IsPpdOrPrdEnv, !Ref TestSNSTopic, !Ref &quot;AWS::NoValue&quot;]
          Type: !If [IsPpdOrPrdEnv, SNS, !Ref &quot;AWS::NoValue&quot;]
    &lt;...&gt;
  </code></pre>
  <p>The error:</p>
  <blockquote>
  <p>Transform AWS::Serverless-2016-10-31 failed with: Internal transform failure.</p>
  </blockquote>
  <p>I also tried:</p>
  <pre class="lang-yaml prettyprint-override"><code>     DeadLetterQueue: 
          !If
            - IsPpdOrPrdEnv
            - 
              TargetArn: !Ref TestSNSTopic
              Type: SNS
            - !Ref &quot;AWS::NoValue&quot;
  </code></pre>
  <p>The error:</p>
  <blockquote>
  <p>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.</p>
  </blockquote>
  <p>Any advise, please?</p>