1. Packages
  2. AWS
  3. API Docs
  4. cognito
  5. IdentityProvider
AWS v6.75.0 published on Wednesday, Apr 2, 2025 by Pulumi

aws.cognito.IdentityProvider

Explore with Pulumi AI

Provides a Cognito User Identity Provider resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.cognito.UserPool("example", {
    name: "example-pool",
    autoVerifiedAttributes: ["email"],
});
const exampleProvider = new aws.cognito.IdentityProvider("example_provider", {
    userPoolId: example.id,
    providerName: "Google",
    providerType: "Google",
    providerDetails: {
        authorize_scopes: "email",
        client_id: "your client_id",
        client_secret: "your client_secret",
    },
    attributeMapping: {
        email: "email",
        username: "sub",
    },
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.cognito.UserPool("example",
    name="example-pool",
    auto_verified_attributes=["email"])
example_provider = aws.cognito.IdentityProvider("example_provider",
    user_pool_id=example.id,
    provider_name="Google",
    provider_type="Google",
    provider_details={
        "authorize_scopes": "email",
        "client_id": "your client_id",
        "client_secret": "your client_secret",
    },
    attribute_mapping={
        "email": "email",
        "username": "sub",
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
			Name: pulumi.String("example-pool"),
			AutoVerifiedAttributes: pulumi.StringArray{
				pulumi.String("email"),
			},
		})
		if err != nil {
			return err
		}
		_, err = cognito.NewIdentityProvider(ctx, "example_provider", &cognito.IdentityProviderArgs{
			UserPoolId:   example.ID(),
			ProviderName: pulumi.String("Google"),
			ProviderType: pulumi.String("Google"),
			ProviderDetails: pulumi.StringMap{
				"authorize_scopes": pulumi.String("email"),
				"client_id":        pulumi.String("your client_id"),
				"client_secret":    pulumi.String("your client_secret"),
			},
			AttributeMapping: pulumi.StringMap{
				"email":    pulumi.String("email"),
				"username": pulumi.String("sub"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Cognito.UserPool("example", new()
    {
        Name = "example-pool",
        AutoVerifiedAttributes = new[]
        {
            "email",
        },
    });

    var exampleProvider = new Aws.Cognito.IdentityProvider("example_provider", new()
    {
        UserPoolId = example.Id,
        ProviderName = "Google",
        ProviderType = "Google",
        ProviderDetails = 
        {
            { "authorize_scopes", "email" },
            { "client_id", "your client_id" },
            { "client_secret", "your client_secret" },
        },
        AttributeMapping = 
        {
            { "email", "email" },
            { "username", "sub" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cognito.UserPool;
import com.pulumi.aws.cognito.UserPoolArgs;
import com.pulumi.aws.cognito.IdentityProvider;
import com.pulumi.aws.cognito.IdentityProviderArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new UserPool("example", UserPoolArgs.builder()
            .name("example-pool")
            .autoVerifiedAttributes("email")
            .build());

        var exampleProvider = new IdentityProvider("exampleProvider", IdentityProviderArgs.builder()
            .userPoolId(example.id())
            .providerName("Google")
            .providerType("Google")
            .providerDetails(Map.ofEntries(
                Map.entry("authorize_scopes", "email"),
                Map.entry("client_id", "your client_id"),
                Map.entry("client_secret", "your client_secret")
            ))
            .attributeMapping(Map.ofEntries(
                Map.entry("email", "email"),
                Map.entry("username", "sub")
            ))
            .build());

    }
}
Copy
resources:
  example:
    type: aws:cognito:UserPool
    properties:
      name: example-pool
      autoVerifiedAttributes:
        - email
  exampleProvider:
    type: aws:cognito:IdentityProvider
    name: example_provider
    properties:
      userPoolId: ${example.id}
      providerName: Google
      providerType: Google
      providerDetails:
        authorize_scopes: email
        client_id: your client_id
        client_secret: your client_secret
      attributeMapping:
        email: email
        username: sub
Copy

Create IdentityProvider Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new IdentityProvider(name: string, args: IdentityProviderArgs, opts?: CustomResourceOptions);
@overload
def IdentityProvider(resource_name: str,
                     args: IdentityProviderArgs,
                     opts: Optional[ResourceOptions] = None)

@overload
def IdentityProvider(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     provider_details: Optional[Mapping[str, str]] = None,
                     provider_name: Optional[str] = None,
                     provider_type: Optional[str] = None,
                     user_pool_id: Optional[str] = None,
                     attribute_mapping: Optional[Mapping[str, str]] = None,
                     idp_identifiers: Optional[Sequence[str]] = None)
func NewIdentityProvider(ctx *Context, name string, args IdentityProviderArgs, opts ...ResourceOption) (*IdentityProvider, error)
public IdentityProvider(string name, IdentityProviderArgs args, CustomResourceOptions? opts = null)
public IdentityProvider(String name, IdentityProviderArgs args)
public IdentityProvider(String name, IdentityProviderArgs args, CustomResourceOptions options)
type: aws:cognito:IdentityProvider
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. IdentityProviderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. IdentityProviderArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. IdentityProviderArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. IdentityProviderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. IdentityProviderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var identityProviderResource = new Aws.Cognito.IdentityProvider("identityProviderResource", new()
{
    ProviderDetails = 
    {
        { "string", "string" },
    },
    ProviderName = "string",
    ProviderType = "string",
    UserPoolId = "string",
    AttributeMapping = 
    {
        { "string", "string" },
    },
    IdpIdentifiers = new[]
    {
        "string",
    },
});
Copy
example, err := cognito.NewIdentityProvider(ctx, "identityProviderResource", &cognito.IdentityProviderArgs{
	ProviderDetails: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ProviderName: pulumi.String("string"),
	ProviderType: pulumi.String("string"),
	UserPoolId:   pulumi.String("string"),
	AttributeMapping: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	IdpIdentifiers: pulumi.StringArray{
		pulumi.String("string"),
	},
})
Copy
var identityProviderResource = new IdentityProvider("identityProviderResource", IdentityProviderArgs.builder()
    .providerDetails(Map.of("string", "string"))
    .providerName("string")
    .providerType("string")
    .userPoolId("string")
    .attributeMapping(Map.of("string", "string"))
    .idpIdentifiers("string")
    .build());
Copy
identity_provider_resource = aws.cognito.IdentityProvider("identityProviderResource",
    provider_details={
        "string": "string",
    },
    provider_name="string",
    provider_type="string",
    user_pool_id="string",
    attribute_mapping={
        "string": "string",
    },
    idp_identifiers=["string"])
Copy
const identityProviderResource = new aws.cognito.IdentityProvider("identityProviderResource", {
    providerDetails: {
        string: "string",
    },
    providerName: "string",
    providerType: "string",
    userPoolId: "string",
    attributeMapping: {
        string: "string",
    },
    idpIdentifiers: ["string"],
});
Copy
type: aws:cognito:IdentityProvider
properties:
    attributeMapping:
        string: string
    idpIdentifiers:
        - string
    providerDetails:
        string: string
    providerName: string
    providerType: string
    userPoolId: string
Copy

IdentityProvider Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The IdentityProvider resource accepts the following input properties:

ProviderDetails This property is required. Dictionary<string, string>
The map of identity details, such as access token
ProviderName
This property is required.
Changes to this property will trigger replacement.
string
The provider name
ProviderType
This property is required.
Changes to this property will trigger replacement.
string
The provider type. See AWS API for valid values
UserPoolId
This property is required.
Changes to this property will trigger replacement.
string
The user pool id
AttributeMapping Dictionary<string, string>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
IdpIdentifiers List<string>
The list of identity providers.
ProviderDetails This property is required. map[string]string
The map of identity details, such as access token
ProviderName
This property is required.
Changes to this property will trigger replacement.
string
The provider name
ProviderType
This property is required.
Changes to this property will trigger replacement.
string
The provider type. See AWS API for valid values
UserPoolId
This property is required.
Changes to this property will trigger replacement.
string
The user pool id
AttributeMapping map[string]string
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
IdpIdentifiers []string
The list of identity providers.
providerDetails This property is required. Map<String,String>
The map of identity details, such as access token
providerName
This property is required.
Changes to this property will trigger replacement.
String
The provider name
providerType
This property is required.
Changes to this property will trigger replacement.
String
The provider type. See AWS API for valid values
userPoolId
This property is required.
Changes to this property will trigger replacement.
String
The user pool id
attributeMapping Map<String,String>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers List<String>
The list of identity providers.
providerDetails This property is required. {[key: string]: string}
The map of identity details, such as access token
providerName
This property is required.
Changes to this property will trigger replacement.
string
The provider name
providerType
This property is required.
Changes to this property will trigger replacement.
string
The provider type. See AWS API for valid values
userPoolId
This property is required.
Changes to this property will trigger replacement.
string
The user pool id
attributeMapping {[key: string]: string}
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers string[]
The list of identity providers.
provider_details This property is required. Mapping[str, str]
The map of identity details, such as access token
provider_name
This property is required.
Changes to this property will trigger replacement.
str
The provider name
provider_type
This property is required.
Changes to this property will trigger replacement.
str
The provider type. See AWS API for valid values
user_pool_id
This property is required.
Changes to this property will trigger replacement.
str
The user pool id
attribute_mapping Mapping[str, str]
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idp_identifiers Sequence[str]
The list of identity providers.
providerDetails This property is required. Map<String>
The map of identity details, such as access token
providerName
This property is required.
Changes to this property will trigger replacement.
String
The provider name
providerType
This property is required.
Changes to this property will trigger replacement.
String
The provider type. See AWS API for valid values
userPoolId
This property is required.
Changes to this property will trigger replacement.
String
The user pool id
attributeMapping Map<String>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers List<String>
The list of identity providers.

Outputs

All input properties are implicitly available as output properties. Additionally, the IdentityProvider resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing IdentityProvider Resource

Get an existing IdentityProvider resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: IdentityProviderState, opts?: CustomResourceOptions): IdentityProvider
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attribute_mapping: Optional[Mapping[str, str]] = None,
        idp_identifiers: Optional[Sequence[str]] = None,
        provider_details: Optional[Mapping[str, str]] = None,
        provider_name: Optional[str] = None,
        provider_type: Optional[str] = None,
        user_pool_id: Optional[str] = None) -> IdentityProvider
func GetIdentityProvider(ctx *Context, name string, id IDInput, state *IdentityProviderState, opts ...ResourceOption) (*IdentityProvider, error)
public static IdentityProvider Get(string name, Input<string> id, IdentityProviderState? state, CustomResourceOptions? opts = null)
public static IdentityProvider get(String name, Output<String> id, IdentityProviderState state, CustomResourceOptions options)
resources:  _:    type: aws:cognito:IdentityProvider    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AttributeMapping Dictionary<string, string>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
IdpIdentifiers List<string>
The list of identity providers.
ProviderDetails Dictionary<string, string>
The map of identity details, such as access token
ProviderName Changes to this property will trigger replacement. string
The provider name
ProviderType Changes to this property will trigger replacement. string
The provider type. See AWS API for valid values
UserPoolId Changes to this property will trigger replacement. string
The user pool id
AttributeMapping map[string]string
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
IdpIdentifiers []string
The list of identity providers.
ProviderDetails map[string]string
The map of identity details, such as access token
ProviderName Changes to this property will trigger replacement. string
The provider name
ProviderType Changes to this property will trigger replacement. string
The provider type. See AWS API for valid values
UserPoolId Changes to this property will trigger replacement. string
The user pool id
attributeMapping Map<String,String>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers List<String>
The list of identity providers.
providerDetails Map<String,String>
The map of identity details, such as access token
providerName Changes to this property will trigger replacement. String
The provider name
providerType Changes to this property will trigger replacement. String
The provider type. See AWS API for valid values
userPoolId Changes to this property will trigger replacement. String
The user pool id
attributeMapping {[key: string]: string}
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers string[]
The list of identity providers.
providerDetails {[key: string]: string}
The map of identity details, such as access token
providerName Changes to this property will trigger replacement. string
The provider name
providerType Changes to this property will trigger replacement. string
The provider type. See AWS API for valid values
userPoolId Changes to this property will trigger replacement. string
The user pool id
attribute_mapping Mapping[str, str]
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idp_identifiers Sequence[str]
The list of identity providers.
provider_details Mapping[str, str]
The map of identity details, such as access token
provider_name Changes to this property will trigger replacement. str
The provider name
provider_type Changes to this property will trigger replacement. str
The provider type. See AWS API for valid values
user_pool_id Changes to this property will trigger replacement. str
The user pool id
attributeMapping Map<String>
The map of attribute mapping of user pool attributes. AttributeMapping in AWS API documentation
idpIdentifiers List<String>
The list of identity providers.
providerDetails Map<String>
The map of identity details, such as access token
providerName Changes to this property will trigger replacement. String
The provider name
providerType Changes to this property will trigger replacement. String
The provider type. See AWS API for valid values
userPoolId Changes to this property will trigger replacement. String
The user pool id

Import

Using pulumi import, import aws_cognito_identity_provider resources using their User Pool ID and Provider Name. For example:

$ pulumi import aws:cognito/identityProvider:IdentityProvider example us-west-2_abc123:CorpAD
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.