AWS Amazon Cognito Identity Provider
This page shows how to write Terraform and CloudFormation for Amazon Cognito Identity Provider and write them securely.
aws_cognito_identity_provider (Terraform)
The Identity Provider in Amazon Cognito can be configured in Terraform with the resource name aws_cognito_identity_provider
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_cognito_identity_provider" "identity-provider-google" {
user_pool_id = aws_cognito_user_pool.user-pool.id
provider_name = "Google"
provider_type = "Google"
provider_details = {
resource "aws_cognito_identity_provider" "idp" {
user_pool_id = var.user_pool_id
provider_name = var.provider_name
provider_type = var.provider_type
provider_details = {
resource "aws_cognito_identity_provider" "google" {
user_pool_id = aws_cognito_user_pool.users.id
provider_name = "Google"
provider_type = "Google"
provider_details = {
resource "aws_cognito_identity_provider" "google" {
user_pool_id = aws_cognito_user_pool.user_pool.id
provider_name = "Google"
provider_type = "Google"
provider_details = {
resource "aws_cognito_identity_provider" "provider" {
user_pool_id = var.user_pool_id
provider_name = var.provider_name
provider_type = var.provider_type
provider_details = {
Parameters
-
attribute_mapping
optional computed - map from string to string -
id
optional computed - string -
idp_identifiers
optional - list of string -
provider_details
required - map from string to string -
provider_name
required - string -
provider_type
required - string -
user_pool_id
required - string
Explanation in Terraform Registry
Provides a Cognito User Identity Provider resource.
AWS::Cognito::UserPoolIdentityProvider (CloudFormation)
The UserPoolIdentityProvider in Cognito can be configured in CloudFormation with the resource name AWS::Cognito::UserPoolIdentityProvider
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
AttributeMapping:
email: email
Username: id
preferred_username: name
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
UserPoolId: !Ref HoSCognitoUserPool
ProviderName: Google
ProviderDetails:
client_id: 712951823298-63bvjn7kmibubnc1pae68egovm3rijo8.apps.googleusercontent.com
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
ProviderName: Google
AttributeMapping:
name: name
email: email
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
UserPoolId: !Ref CognitoUserPoolAppUserPool
ProviderName: "Facebook"
ProviderDetails:
client_id: FACEBOOK_CLIENT_ID #TODO
Type: AWS::Cognito::UserPoolIdentityProvider
Properties:
ProviderName: Google
AttributeMapping:
name: name
email: email
"Type": "AWS::Cognito::UserPoolIdentityProvider",
"Properties": {
"ProviderName": "LoginWithAmazon",
"ProviderType": "LoginWithAmazon",
"UserPoolId": {
"Ref": "pool056F3F7E"
"Type": "AWS::Cognito::UserPoolIdentityProvider",
"Properties": {
"ProviderName": "Google",
"ProviderType": "Google",
"UserPoolId": {
"Ref": "pool056F3F7E"
"Type": "AWS::Cognito::UserPoolIdentityProvider",
"Properties": {
"ProviderName": "SignInWithApple",
"ProviderType": "SignInWithApple",
"UserPoolId": {
"Ref": "pool056F3F7E"
"AWS::Cognito::UserPoolIdentityProvider": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolidentityprovider.html",
"Properties": {
"ProviderName": {
"Required": true,
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpoolidentityprovider.html#cfn-cognito-userpoolidentityprovider-providername",
"Type": "AWS::Cognito::UserPoolIdentityProvider",
"Properties": {
"UserPoolId": {
"Ref": "TFCRUserPool"
},
"ProviderName": "Google",
Parameters
-
ProviderName
required - String -
UserPoolId
required - String -
AttributeMapping
optional - Json -
ProviderDetails
optional - Json -
ProviderType
required - String -
IdpIdentifiers
optional - List
Explanation in CloudFormation Registry
The
AWS::Cognito::UserPoolIdentityProvider
resource creates an identity provider for a user pool.
Frequently asked questions
What is AWS Amazon Cognito Identity Provider?
AWS Amazon Cognito Identity Provider is a resource for Amazon Cognito of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Amazon Cognito Identity Provider?
For Terraform, the MHekert/nestjs-auth, mjedrasz/ttd-terraform and Dromadon/hallebarde source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the avi-leeker/examples, Helfer-Portal/helponspot-api-gateway and wednesday-solutions/serverless source code examples are useful. See the CloudFormation Example section for further details.