UserPoolIdentityProvider was added in Oct 2019, official docs.
Your CloudFormation would then look something like
CognitoUserPoolIdentityProvider:
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
ProviderName: Google
AttributeMapping:
email: emailAddress
ProviderDetails:
client_id: <yourclientid>.apps.googleusercontent.com
client_secret: <yourclientsecret>
authorize_scopes: email openid
ProviderType: Google
UserPoolId:
Ref: CognitoUserPool
It seems a lot of Cognito details are not supported within Cloudformation as of right now, but there are ways to achieve what you want after the stack spins up, e.g. using Lambdas.
See the following answers:
Cannot set a property of cognito userpool client via cloudformation
You can achieve this using Lambda function as custom Cloudformation resources. I have made custom resources to allow creation of user pool domain, client settings and Identity providers on this repo
You will have somethings like this for creating identity provider, for example Facebook
FacebookIdp:
Type: 'Custom::${self:service}-${self:provider.stage}-CUPIdentityProvider'
DependsOn:
- CFNSendResponseLambdaFunction
- CUPIdentityProviderLambdaFunction
Properties:
ServiceToken:
Fn::GetAtt: [CUPIdentityProviderLambdaFunction, Arn]
UserPoolId:
Ref: AppUserPool
ProviderName: Facebook
ProviderType: Facebook
Client_id: 'YourFacebookAppID'
Client_secret: 'YourFacebookAppSecert'
Authorize_scopes: 'public_profile,email'
And then enable that identity provider on the user pool client settings
AppUserPoolClientSettings:
Type: 'Custom::${self:service}-${self:provider.stage}-CUPClientSettings'
DependsOn:
- CFNSendResponseLambdaFunction
- CUPClientSettingsLambdaFunction
- FacebookIdp
Properties:
ServiceToken:
Fn::GetAtt: [ CUPClientSettingsLambdaFunction, Arn]
UserPoolId:
Ref: AppUserPool
UserPoolClientId:
Ref: AppUserPoolClient
SupportedIdentityProviders:
- COGNITO
- Facebook
CallbackURL: 'https://www.yourdomain.com/callback' ##Replace this with your app callback url
LogoutURL: 'https://www.yourdomain.com/logout' ##Replace this with your app logout url
AllowedOAuthFlowsUserPoolClient: true
AllowedOAuthFlows:
- code
AllowedOAuthScopes:
- openid
Note that this repo is built using Serverless framework, if you wish to build this with pure cloudformation stacks, use the code on file CUPIdentityProvider.js to make your own custom resource.