IdentityPool class

Provides an AWS Cognito Identity Pool.

Example Usage

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

const _default = new aws.iam.SamlProvider("default", {
    name: "my-saml-provider",
    samlMetadataDocument: std.file({
        input: "saml-metadata.xml",
    }).then(invoke => invoke.result),
});
const main = new aws.cognito.IdentityPool("main", {
    cognitoIdentityProviders: [
        {
            clientId: "6lhlkkfbfb4q5kpp90urffae",
            providerName: "cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ",
            serverSideTokenCheck: false,
        },
        {
            clientId: "7kodkvfqfb4qfkp39eurffae",
            providerName: "cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu",
            serverSideTokenCheck: false,
        },
    ],
    identityPoolName: "identity pool",
    allowUnauthenticatedIdentities: false,
    allowClassicFlow: false,
    supportedLoginProviders: {
        "graph.facebook.com": "7346241598935552",
        "accounts.google.com": "123456789012.apps.googleusercontent.com",
    },
    samlProviderArns: [_default.arn],
    openidConnectProviderArns: ["arn:aws:iam::123456789012:oidc-provider/id.example.com"],
});
import pulumi
import pulumi_aws as aws
import pulumi_std as std

default = aws.iam.SamlProvider("default",
    name="my-saml-provider",
    saml_metadata_document=std.file(input="saml-metadata.xml").result)
main = aws.cognito.IdentityPool("main",
    cognito_identity_providers=[
        {
            "client_id": "6lhlkkfbfb4q5kpp90urffae",
            "provider_name": "cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ",
            "server_side_token_check": False,
        },
        {
            "client_id": "7kodkvfqfb4qfkp39eurffae",
            "provider_name": "cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu",
            "server_side_token_check": False,
        },
    ],
    identity_pool_name="identity pool",
    allow_unauthenticated_identities=False,
    allow_classic_flow=False,
    supported_login_providers={
        "graph.facebook.com": "7346241598935552",
        "accounts.google.com": "123456789012.apps.googleusercontent.com",
    },
    saml_provider_arns=[default.arn],
    openid_connect_provider_arns=["arn:aws:iam::123456789012:oidc-provider/id.example.com"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() =>
{
    var @default = new Aws.Iam.SamlProvider("default", new()
    {
        Name = "my-saml-provider",
        SamlMetadataDocument = Std.File.Invoke(new()
        {
            Input = "saml-metadata.xml",
        }).Apply(invoke => invoke.Result),
    });

    var main = new Aws.Cognito.IdentityPool("main", new()
    {
        CognitoIdentityProviders = new[]
        {
            new Aws.Cognito.Inputs.IdentityPoolCognitoIdentityProviderArgs
            {
                ClientId = "6lhlkkfbfb4q5kpp90urffae",
                ProviderName = "cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ",
                ServerSideTokenCheck = false,
            },
            new Aws.Cognito.Inputs.IdentityPoolCognitoIdentityProviderArgs
            {
                ClientId = "7kodkvfqfb4qfkp39eurffae",
                ProviderName = "cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu",
                ServerSideTokenCheck = false,
            },
        },
        IdentityPoolName = "identity pool",
        AllowUnauthenticatedIdentities = false,
        AllowClassicFlow = false,
        SupportedLoginProviders =
        {
            { "graph.facebook.com", "7346241598935552" },
            { "accounts.google.com", "123456789012.apps.googleusercontent.com" },
        },
        SamlProviderArns = new[]
        {
            @default.Arn,
        },
        OpenidConnectProviderArns = new[]
        {
            "arn:aws:iam::123456789012:oidc-provider/id.example.com",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cognito"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "saml-metadata.xml",
		}, nil)
		if err != nil {
			return err
		}
		_default, err := iam.NewSamlProvider(ctx, "default", &iam.SamlProviderArgs{
			Name:                 pulumi.String("my-saml-provider"),
			SamlMetadataDocument: pulumi.String(invokeFile.Result),
		})
		if err != nil {
			return err
		}
		_, err = cognito.NewIdentityPool(ctx, "main", &cognito.IdentityPoolArgs{
			CognitoIdentityProviders: cognito.IdentityPoolCognitoIdentityProviderArray{
				&cognito.IdentityPoolCognitoIdentityProviderArgs{
					ClientId:             pulumi.String("6lhlkkfbfb4q5kpp90urffae"),
					ProviderName:         pulumi.String("cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ"),
					ServerSideTokenCheck: pulumi.Bool(false),
				},
				&cognito.IdentityPoolCognitoIdentityProviderArgs{
					ClientId:             pulumi.String("7kodkvfqfb4qfkp39eurffae"),
					ProviderName:         pulumi.String("cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu"),
					ServerSideTokenCheck: pulumi.Bool(false),
				},
			},
			IdentityPoolName:               pulumi.String("identity pool"),
			AllowUnauthenticatedIdentities: pulumi.Bool(false),
			AllowClassicFlow:               pulumi.Bool(false),
			SupportedLoginProviders: pulumi.StringMap{
				"graph.facebook.com":  pulumi.String("7346241598935552"),
				"accounts.google.com": pulumi.String("123456789012.apps.googleusercontent.com"),
			},
			SamlProviderArns: pulumi.StringArray{
				_default.Arn,
			},
			OpenidConnectProviderArns: pulumi.StringArray{
				pulumi.String("arn:aws:iam::123456789012:oidc-provider/id.example.com"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
    std = {
      source = "pulumi/std"
    }
  }
}

resource "aws_iam_samlprovider" "default" {
  name                   = "my-saml-provider"
  saml_metadata_document = file("saml-metadata.xml")
}
resource "aws_cognito_identitypool" "main" {
  cognito_identity_providers {
    client_id               = "6lhlkkfbfb4q5kpp90urffae"
    provider_name           = "cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ"
    server_side_token_check = false
  }
  cognito_identity_providers {
    client_id               = "7kodkvfqfb4qfkp39eurffae"
    provider_name           = "cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu"
    server_side_token_check = false
  }
  identity_pool_name               = "identity pool"
  allow_unauthenticated_identities = false
  allow_classic_flow               = false
  supported_login_providers = {
    "graph.facebook.com"  = "7346241598935552"
    "accounts.google.com" = "123456789012.apps.googleusercontent.com"
  }
  saml_provider_arns           = [aws_iam_samlprovider.default.arn]
  openid_connect_provider_arns = ["arn:aws:iam::123456789012:oidc-provider/id.example.com"]
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.SamlProvider;
import com.pulumi.aws.iam.SamlProviderArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.FileArgs;
import com.pulumi.aws.cognito.IdentityPool;
import com.pulumi.aws.cognito.IdentityPoolArgs;
import com.pulumi.aws.cognito.inputs.IdentityPoolCognitoIdentityProviderArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default_ = new SamlProvider("default", SamlProviderArgs.builder()
            .name("my-saml-provider")
            .samlMetadataDocument(StdFunctions.file(FileArgs.builder()
                .input("saml-metadata.xml")
                .build()).result())
            .build());

        var main = new IdentityPool("main", IdentityPoolArgs.builder()
            .cognitoIdentityProviders(
                IdentityPoolCognitoIdentityProviderArgs.builder()
                    .clientId("6lhlkkfbfb4q5kpp90urffae")
                    .providerName("cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ")
                    .serverSideTokenCheck(false)
                    .build(),
                IdentityPoolCognitoIdentityProviderArgs.builder()
                    .clientId("7kodkvfqfb4qfkp39eurffae")
                    .providerName("cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu")
                    .serverSideTokenCheck(false)
                    .build())
            .identityPoolName("identity pool")
            .allowUnauthenticatedIdentities(false)
            .allowClassicFlow(false)
            .supportedLoginProviders(Map.ofEntries(
                Map.entry("graph.facebook.com", "7346241598935552"),
                Map.entry("accounts.google.com", "123456789012.apps.googleusercontent.com")
            ))
            .samlProviderArns(default_.arn())
            .openidConnectProviderArns("arn:aws:iam::123456789012:oidc-provider/id.example.com")
            .build());

    }
}
resources:
  default:
    type: aws:iam:SamlProvider
    properties:
      name: my-saml-provider
      samlMetadataDocument:
        fn::invoke:
          function: std:file
          arguments:
            input: saml-metadata.xml
          return: result
  main:
    type: aws:cognito:IdentityPool
    properties:
      cognitoIdentityProviders:
        - clientId: 6lhlkkfbfb4q5kpp90urffae
          providerName: cognito-idp.us-east-1.amazonaws.com/us-east-1_Tv0493apJ
          serverSideTokenCheck: false
        - clientId: 7kodkvfqfb4qfkp39eurffae
          providerName: cognito-idp.us-east-1.amazonaws.com/eu-west-1_Zr231apJu
          serverSideTokenCheck: false
      identityPoolName: identity pool
      allowUnauthenticatedIdentities: false
      allowClassicFlow: false
      supportedLoginProviders:
        graph.facebook.com: '7346241598935552'
        accounts.google.com: 123456789012.apps.googleusercontent.com
      samlProviderArns:
        - ${default.arn}
      openidConnectProviderArns:
        - arn:aws:iam::123456789012:oidc-provider/id.example.com

Import

Using pulumi import, import Cognito Identity Pool using its ID. For example:

$ pulumi import aws:cognito/identityPool:IdentityPool mypool us-west-2:1a234567-8901-234b-5cde-f6789g01h2i3

Constructors

IdentityPool(String name, {IdentityPoolArgs? args, CustomResourceOptions? options})
Creates a new IdentityPool. name The Pulumi resource name. args Arguments used to configure this IdentityPool. The set of arguments for IdentityPool. options Resource options controlling this resource's behavior.
IdentityPool.reference(String urn)
Creates a typed reference to an existing IdentityPool resource.

Properties

allowClassicFlow ↔ Output<bool?>
Enables or disables the classic / basic authentication flow. Default is false.
latefinal
allowUnauthenticatedIdentities ↔ Output<bool?>
Whether the identity pool supports unauthenticated logins or not.
latefinal
arn ↔ Output<String>
The ARN of the identity pool.
latefinal
childResources → Set<Resource>
finalinherited
cognitoIdentityProviders ↔ Output<List<IdentityPoolCognitoIdentityProvider>?>
An array of Amazon Cognito Identity user pools and their client IDs.
latefinal
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
developerProviderName ↔ Output<String?>
The "domain" by which Cognito will refer to your users. This name acts as a placeholder that allows your backend and the Cognito service to communicate about the developer provider.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
identityPoolName ↔ Output<String>
The Cognito Identity Pool name.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
openidConnectProviderArns ↔ Output<List<String>?>
Set of OpendID Connect provider ARNs.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
samlProviderArns ↔ Output<List<String>?>
An array of ARNs of the SAML provider for your identity.
latefinal
supportedLoginProviders ↔ Output<Map<String, String>?>
Key-Value pairs mapping provider names to provider app IDs.
latefinal
tags ↔ Output<Map<String, String>?>
A map of tags to assign to the Identity Pool. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {IdentityPoolState? state, CustomResourceOptions? options}) → IdentityPool
Gets an existing IdentityPool resource's state with the given name and id.