aws / aws/serverless-application-model

Cognito UserPools resource is outdated

Open
#3,726 2 comments 0 reactions 0 assignees View on GitHub
contributors/good-first-issue contributors/welcome stage/needs-triage type/bug
Dominant language
Python
Stars
9.6k
Forks
2.5k
Avg merge
1d 11h
Merged PRs (30d)
7

Description

### Description
SAM-T doesn't support using newer fields from [Cognito UserPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html#cfn-cognito-userpool-userpooltier). In particular, there's a recent `UserPoolTier` field that was released at the end of last year.

The `CognitoUserPool` model is not updated:
https://github.com/aws/serverless-application-model/blob/3ed5efe56a5b4f24f2214a6c7d57b00fc4f7c731/samtranslator/model/cognito.py#L5-L6

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](https://github.com/aws/serverless-application-model/blame/3ed5efe56a5b4f24f2214a6c7d57b00fc4f7c731/samtranslator/model/eventsources/push.py#L1266-L1267)

### 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](https://github.com/aws/aws-sam-cli), `sam --version`:
3. AWS region:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.