Skip to content

Cognito UserPools resource is outdated #3726

Open
@valerena

Description

@valerena

Description

SAM-T doesn't support using newer fields from Cognito UserPool. In particular, there's a recent UserPoolTier field that was released at the end of last year.

The CognitoUserPool model is not updated:

class CognitoUserPool(Resource):
resource_type = "AWS::Cognito::UserPool"

Normally SAM-T would ignore non-Serverless, but because of the Cognito Event, SAM-T needs to read this resource to inject the Lambda configuration

Steps to reproduce

You can reproduce the problem with this template:

Transform: AWS::Serverless-2016-10-31

Resources:
  HelloWorldFunction:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: "s3://helloworld"
      Handler: app.lambda_handler
      Runtime: python3.11
      Events:
        myEvent:
          Properties:
            Trigger: MyEvent
            UserPool: !Ref ExampleUserPool
          Type: Cognito
  
  ExampleUserPool:
    Type: AWS::Cognito::UserPool
    Properties:
      UserPoolName: Example_CloudFormation_UserPool
      UserPoolTier: PLUS

Observed result

If you try to transform that, you get an error

ERROR:__main__:Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [ExampleUserPool] is invalid. property UserPoolTier not defined for resource of type AWS::Cognito::UserPool

Expected result

Template should be correctly transformed.

Additional environment details

  1. OS:
  2. If using the SAM CLI, sam --version:
  3. AWS region:

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributors/good-first-issueGood first issue for a contributorcontributors/welcomeContributors are welcome to work on thisstage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.type/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions