Skip to content

AWS::Serverless::Api - Auth property doesn't allow intrinsic functions? #1184

@beatleboy501

Description

@beatleboy501

I am currently deploying an API to multiple environments (prod, test, dev). I would like to turn off "Auth" in dev so we can focus on developing post-login features in that environment. However it is not possible to conditionally add the "Auth" property to my Api resource because of how we are validating:

https://github.com/awslabs/serverless-application-model/blob/4fa5d6a4ec60e82681daae6f0ff9d7669642c266/samtranslator/model/api/api_generator.py#L312

Therefore something like this is not possible currently:

Api:
  Type: AWS::Serverless::Api
  Properties:
    ...
    Auth:
      Fn::If:
        - IsDev
        - !Ref "AWS::NoValue"
        - DefaultAuthorizer: CognitoAuthorizer
          Authorizers:
            CognitoAuthorizer:
              UserPoolArn: !GetAtt UserPool.Arn
              Identity:
                Header: Authorization
                ValidationExpression: "." 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions