Search code examples
aws-cloudformationaws-sam

AWS::CloudFormation - Fn::If requires a list argument with three elements


I have this error but I do not have Fn::If in this SAM template !


Solution

  • Txt @Renato, in my SAM template, I dot not have Fn::If but I have !If

    the last week, this worked (but not today ;)):

    Globals:
      Function:
        DeploymentPreference:
          Alarms:
            - !If
              - IsProd
              - !Ref AliasErrorMetricGreaterThanZeroAlarm
              
    

    but now, AWS need 3 param, so I add - Ref: "AWS::NoValue"

    new AWS SAM template is:

    Globals:
      Function:
        DeploymentPreference:
          Alarms:
            - !If
              - IsProd
              - !Ref AliasErrorMetricGreaterThanZeroAlarm
              - Ref: "AWS::NoValue"