User class
Provides a Cognito User Resource.
Example Usage
Basic configuration
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {name: "MyExamplePool"});
const exampleUser = new aws.cognito.User("example", {
userPoolId: example.id,
username: "example",
});
import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example", name="MyExamplePool")
example_user = aws.cognito.User("example",
user_pool_id=example.id,
username="example")
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 = "MyExamplePool",
});
var exampleUser = new Aws.Cognito.User("example", new()
{
UserPoolId = example.Id,
Username = "example",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/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("MyExamplePool"),
})
if err != nil {
return err
}
_, err = cognito.NewUser(ctx, "example", &cognito.UserArgs{
UserPoolId: example.ID().ToIDOutput().ToStringOutput(),
Username: pulumi.String("example"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cognito_userpool" "example" {
name = "MyExamplePool"
}
resource "aws_cognito_user" "example" {
user_pool_id = aws_cognito_userpool.example.id
username = "example"
}
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.User;
import com.pulumi.aws.cognito.UserArgs;
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 example = new UserPool("example", UserPoolArgs.builder()
.name("MyExamplePool")
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(example.id())
.username("example")
.build());
}
}
resources:
example:
type: aws:cognito:UserPool
properties:
name: MyExamplePool
exampleUser:
type: aws:cognito:User
name: example
properties:
userPoolId: ${example.id}
username: example
Setting user attributes
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.cognito.UserPool("example", {
schemas: [
{
name: "example",
attributeDataType: "Boolean",
mutable: false,
required: false,
developerOnlyAttribute: false,
},
{
stringAttributeConstraints: {},
name: "foo",
attributeDataType: "String",
mutable: false,
required: false,
developerOnlyAttribute: false,
},
],
name: "mypool",
});
const exampleUser = new aws.cognito.User("example", {
userPoolId: example.id,
username: "example",
attributes: {
example: "true",
foo: "bar",
email: "no-reply@example.com",
email_verified: "true",
},
});
import pulumi
import pulumi_aws as aws
example = aws.cognito.UserPool("example",
schemas=[
{
"name": "example",
"attribute_data_type": "Boolean",
"mutable": False,
"required": False,
"developer_only_attribute": False,
},
{
"string_attribute_constraints": {},
"name": "foo",
"attribute_data_type": "String",
"mutable": False,
"required": False,
"developer_only_attribute": False,
},
],
name="mypool")
example_user = aws.cognito.User("example",
user_pool_id=example.id,
username="example",
attributes={
"example": "true",
"foo": "bar",
"email": "no-reply@example.com",
"email_verified": "true",
})
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()
{
Schemas = new[]
{
new Aws.Cognito.Inputs.UserPoolSchemaArgs
{
Name = "example",
AttributeDataType = "Boolean",
Mutable = false,
Required = false,
DeveloperOnlyAttribute = false,
},
new Aws.Cognito.Inputs.UserPoolSchemaArgs
{
StringAttributeConstraints = null,
Name = "foo",
AttributeDataType = "String",
Mutable = false,
Required = false,
DeveloperOnlyAttribute = false,
},
},
Name = "mypool",
});
var exampleUser = new Aws.Cognito.User("example", new()
{
UserPoolId = example.Id,
Username = "example",
Attributes =
{
{ "example", "true" },
{ "foo", "bar" },
{ "email", "no-reply@example.com" },
{ "email_verified", "true" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/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{
Schemas: cognito.UserPoolSchemaArray{
&cognito.UserPoolSchemaArgs{
Name: pulumi.String("example"),
AttributeDataType: pulumi.String("Boolean"),
Mutable: pulumi.Bool(false),
Required: pulumi.Bool(false),
DeveloperOnlyAttribute: pulumi.Bool(false),
},
&cognito.UserPoolSchemaArgs{
StringAttributeConstraints: &cognito.UserPoolSchemaStringAttributeConstraintsArgs{},
Name: pulumi.String("foo"),
AttributeDataType: pulumi.String("String"),
Mutable: pulumi.Bool(false),
Required: pulumi.Bool(false),
DeveloperOnlyAttribute: pulumi.Bool(false),
},
},
Name: pulumi.String("mypool"),
})
if err != nil {
return err
}
_, err = cognito.NewUser(ctx, "example", &cognito.UserArgs{
UserPoolId: example.ID().ToIDOutput().ToStringOutput(),
Username: pulumi.String("example"),
Attributes: pulumi.StringMap{
"example": pulumi.String("true"),
"foo": pulumi.String("bar"),
"email": pulumi.String("no-reply@example.com"),
"email_verified": pulumi.String("true"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_cognito_userpool" "example" {
schemas {
name = "example"
attribute_data_type = "Boolean"
mutable = false
required = false
developer_only_attribute = false
}
schemas {
string_attribute_constraints = {}
name = "foo"
attribute_data_type = "String"
mutable = false
required = false
developer_only_attribute = false
}
name = "mypool"
}
resource "aws_cognito_user" "example" {
user_pool_id = aws_cognito_userpool.example.id
username = "example"
attributes = {
"example" = true
"foo" = "bar"
"email" = "no-reply@example.com"
"email_verified" = true
}
}
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.inputs.UserPoolSchemaArgs;
import com.pulumi.aws.cognito.inputs.UserPoolSchemaStringAttributeConstraintsArgs;
import com.pulumi.aws.cognito.User;
import com.pulumi.aws.cognito.UserArgs;
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 example = new UserPool("example", UserPoolArgs.builder()
.schemas(
UserPoolSchemaArgs.builder()
.name("example")
.attributeDataType("Boolean")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.build(),
UserPoolSchemaArgs.builder()
.stringAttributeConstraints(UserPoolSchemaStringAttributeConstraintsArgs.builder()
.build())
.name("foo")
.attributeDataType("String")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.build())
.name("mypool")
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(example.id())
.username("example")
.attributes(Map.ofEntries(
Map.entry("example", "true"),
Map.entry("foo", "bar"),
Map.entry("email", "no-reply@example.com"),
Map.entry("email_verified", "true")
))
.build());
}
}
resources:
example:
type: aws:cognito:UserPool
properties:
schemas:
- name: example
attributeDataType: Boolean
mutable: false
required: false
developerOnlyAttribute: false
- stringAttributeConstraints: {}
name: foo
attributeDataType: String
mutable: false
required: false
developerOnlyAttribute: false
name: mypool
exampleUser:
type: aws:cognito:User
name: example
properties:
userPoolId: ${example.id}
username: example
attributes:
example: true
foo: bar
email: no-reply@example.com
email_verified: true
Import
Using pulumi import, import Cognito User using the userPoolId/name attributes concatenated. For example:
$ pulumi import aws:cognito/user:User user us-east-1_vG78M4goG/user
Constructors
- User(String name, {UserArgs? args, CustomResourceOptions? options})
-
Creates a new User.
nameThe Pulumi resource name.argsArguments used to configure this User. The set of arguments for User.optionsResource options controlling this resource's behavior. - User.reference(String urn)
- Creates a typed reference to an existing User resource.
Properties
-
attributes
↔ Output<
Map< String, String> ?> -
A map that contains user attributes and attribute values to be set for the user.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
clientMetadata
↔ Output<
Map< String, String> ?> -
A map of custom key-value pairs that you can provide as input for any custom workflows that user creation triggers. Amazon Cognito does not store the
clientMetadatavalue. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration does not include triggers, the ClientMetadata parameter serves no purpose. For more information, see Customizing User Pool Workflows with Lambda Triggers.latefinal -
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
creationDate
↔ Output<
String> -
latefinal
-
desiredDeliveryMediums
↔ Output<
List< String> ?> -
A list of mediums to the welcome message will be sent through. Allowed values are
EMAILandSMS. If it's provided, make sure you have also specifiedemailattribute for theEMAILmedium andphoneNumberfor theSMS. More than one value can be specified. Amazon Cognito does not store thedesiredDeliveryMediumsvalue. Defaults to["SMS"].latefinal -
enabled
↔ Output<
bool?> -
Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the
enabledvalue. The behavior can be changed withmessageActionargument. Defaults totrue.latefinal -
forceAliasCreation
↔ Output<
bool?> -
If this parameter is set to True and the
phoneNumberoremailaddress specified in theattributesparameter already exists as an alias with a different user, Amazon Cognito will migrate the alias from the previous user to the newly created user. The previous user will no longer be able to log in using that alias. Amazon Cognito does not store theforceAliasCreationvalue. Defaults tofalse.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- 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
-
lastModifiedDate
↔ Output<
String> -
latefinal
-
messageAction
↔ Output<
String?> -
Set to
RESENDto resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set toSUPPRESSto suppress sending the message. Only one value can be specified. Amazon Cognito does not store themessageActionvalue.latefinal -
mfaSettingLists
↔ Output<
List< String> > -
latefinal
-
password
↔ Output<
String?> -
The user's permanent password. This password must conform to the password policy specified by user pool the user belongs to. The welcome message always contains only
temporaryPasswordvalue. You can suppress sending the welcome message with themessageActionargument. Amazon Cognito does not store thepasswordvalue. Conflicts withtemporaryPassword.latefinal -
preferredMfaSetting
↔ Output<
String> -
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
-
status
↔ Output<
String> -
current user status.
latefinal
-
sub
↔ Output<
String> -
unique user id that is never reassignable to another user.
latefinal
-
temporaryPassword
↔ Output<
String?> -
The user's temporary password. Conflicts with
password.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
username
↔ Output<
String> -
The username for the user. Must be unique within the user pool. Must be a UTF-8 string between 1 and 128 characters. After the user is created, the username cannot be changed.
latefinal
-
userPoolId
↔ Output<
String> -
The user pool ID for the user pool where the user will be created.
latefinal
-
validationData
↔ Output<
Map< String, String> ?> -
The user's validation data. This is an array of name-value pairs that contain user attributes and attribute values that you can use for custom validation, such as restricting the types of user accounts that can be registered. Amazon Cognito does not store the
validationDatavalue. For more information, see Customizing User Pool Workflows with Lambda Triggers.latefinal
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