1. Packages
  2. AWS
  3. API Docs
  4. cognito
  5. IdentityProvider
AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi

aws.cognito.IdentityProvider

Explore with Pulumi AI

aws logo
AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi

    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",
        },
    });
    
    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",
        })
    
    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
    	})
    }
    
    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" },
            },
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    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 string
    The unique name of the resource.
    args IdentityProviderArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args 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 string
    The unique name of the resource.
    args IdentityProviderArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IdentityProviderArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args 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",
        },
    });
    
    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"),
    	},
    })
    
    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());
    
    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"])
    
    const identityProviderResource = new aws.cognito.IdentityProvider("identityProviderResource", {
        providerDetails: {
            string: "string",
        },
        providerName: "string",
        providerType: "string",
        userPoolId: "string",
        attributeMapping: {
            string: "string",
        },
        idpIdentifiers: ["string"],
    });
    
    type: aws:cognito:IdentityProvider
    properties:
        attributeMapping:
            string: string
        idpIdentifiers:
            - string
        providerDetails:
            string: string
        providerName: string
        providerType: string
        userPoolId: string
    

    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 Dictionary<string, string>
    The map of identity details, such as access token
    ProviderName string
    The provider name
    ProviderType string
    The provider type. See AWS API for valid values
    UserPoolId 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 map[string]string
    The map of identity details, such as access token
    ProviderName string
    The provider name
    ProviderType string
    The provider type. See AWS API for valid values
    UserPoolId 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 String
    The provider name
    providerType String
    The provider type. See AWS API for valid values
    userPoolId 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 {[key: string]: string}
    The map of identity details, such as access token
    providerName string
    The provider name
    providerType string
    The provider type. See AWS API for valid values
    userPoolId 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 Mapping[str, str]
    The map of identity details, such as access token
    provider_name str
    The provider name
    provider_type str
    The provider type. See AWS API for valid values
    user_pool_id 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 Map<String>
    The map of identity details, such as access token
    providerName String
    The provider name
    providerType String
    The provider type. See AWS API for valid values
    userPoolId 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)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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 string
    The provider name
    ProviderType string
    The provider type. See AWS API for valid values
    UserPoolId 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 string
    The provider name
    ProviderType string
    The provider type. See AWS API for valid values
    UserPoolId 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 String
    The provider name
    providerType String
    The provider type. See AWS API for valid values
    userPoolId 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 string
    The provider name
    providerType string
    The provider type. See AWS API for valid values
    userPoolId 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 str
    The provider name
    provider_type str
    The provider type. See AWS API for valid values
    user_pool_id 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 String
    The provider name
    providerType String
    The provider type. See AWS API for valid values
    userPoolId 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
    

    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.
    aws logo
    AWS v6.64.0 published on Friday, Dec 6, 2024 by Pulumi