How do I set the resource property CognitoUserPool:Properties:UsernameConfiguration:CaseSensitive

I can see it was added to SAM-CLI here: https://github.com/awslabs/serverless-application-model/commit/b255f51f99cfdc19c17428dc35460682a13ccf19

what is the equivalent yml setting for it? I have:

CognitoUserPool:
  Type: "AWS::Cognito::UserPool"
  Properties:
    UserPoolName: ${self:provider.stage}-user-pool
    UsernameConfiguration:
      CaseSensitive: false
    UsernameAttributes:
      - email
    AutoVerifiedAttributes:
      - email
    Policies:
      PasswordPolicy:
        RequireLowercase: false
        RequireSymbols: false
        RequireNumbers: false
        MinimumLength: 6
        RequireUppercase: false

which just gives me:
An error occurred: CognitoUserPool - Updates are not allowed for property - UsernameConfiguration. (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: InvalidParameterException; Request ID: null).

Hi,

I think this is one of the settings that cannot be changed once the user pool is created. You can’t even change it in the cognito console itself.

If you haven’t already got genuine user data in there, you can remove the stack and then redeploy to get the case sensitivity set correctly.

Yes thats why I am asking when creating the userpool fresh from serverless how do I set it correct the first time because like you say the value can’t be changed later, even from the UI

Sorry, misread the question.

That is quite odd as I have been using this CaseSensitive property successfully.

I have created a brand new serverless project and copied and pasted your resource into it and it also worked fine. See below.


provider:
  name: aws
  runtime: nodejs12.x
  region: eu-west-2

resources:
  Resources:
    CognitoUserPool:
      Type: "AWS::Cognito::UserPool"
      Properties:
        UserPoolName: pool-test
        UsernameConfiguration:
          CaseSensitive: false
        UsernameAttributes:
          - email
        AutoVerifiedAttributes:
          - email
        Policies:
          PasswordPolicy:
            RequireLowercase: false
            RequireSymbols: false
            RequireNumbers: false
            MinimumLength: 6
            RequireUppercase: false

Could it be the version of serverless you are using perhaps? I am running on v 1.70.1 at the moment?