amazon-web-servicesaws-cloudformationamazon-cognitoaws-userpools

Property validation failure - Cloudformation Template for AWS::Cognito::UserPool


I keep getting a Property validation failure error in cloudformation when I run my AWS::Cognito::UserPool resource template. Here's how the scripts look like

Resources:
  ESRVCognitoUserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: !Sub '${AWS::StackName}-CognitoUserPool'
      AdminCreateUserConfig: 
        AllowAdminCreateUserOnly: 'True'
      UserPoolTags: !Sub '${AWS::StackName}'
      Schema:
        - Name: 'country_code'
          AttributeDataType: 'String'
          Mutable: 'true'
          Required: 'false'
          DeveloperOnlyAttribute: 'false'
          StringAttributeConstraints: 
            MaxLength: '2048'
            MinLength: '1'
        - Name: "contact_id"
          AttributeDataType: String
          Mutable: 'true'
          Required: 'false'
          DeveloperOnlyAttribute: 'false'
          StringAttributeConstraints: 
            MaxLength: '2048'
            MinLength: '1'
        - Name: "language"
          AttributeDataType: String
          Mutable: 'true'
          Required: 'false'
          DeveloperOnlyAttribute: 'false'
          StringAttributeConstraints: 
            MaxLength: '256'
            MinLength: '1'
        - Name: "account_id"
          AttributeDataType: String
          Mutable: 'true'
          Required: 'false'
          DeveloperOnlyAttribute: 'false'
          StringAttributeConstraints: 
            MaxLength: '2048'
            MinLength: '1'
        - Name: "tracking_id"
          AttributeDataType: String
          Mutable: 'true'
          Required: 'false'
          DeveloperOnlyAttribute: 'false'
          StringAttributeConstraints: 
            MaxLength: '256'
            MinLength: '1'
Outputs:
  StackName:
    Description: 'Stack name.'
    Value: !Sub '${AWS::StackName}'
  UserPoolInfo:
    Description: 'UserPool Information'
    Value: !Ref ESRVCognitoUserPool
    Export:
      Name: UserPool-ID

I'd appreciate any tips.


Solution

  • According to the documentation UserPoolTags is of JSON type. You aren't allowed to pass a simple string to it.

    See this question on how to properly pass a value.