I'm trying to create a Cognito User Pool through Cloudformation but I'm unable to define a template that allow users to use an email address or phone number as their “username” to sign up and sign in to my application.
I have created an AWS::Cognito::UserPool setting phone_number and email as AliasAttributes, but when I try to sign up with an email or phone number as username I get a message telling that the username cannot match an email or phone number format.

I can define that through AWS Management Console (image above). Does anyone know how I can achieve that through Cloudformation template?