UserArgs

data class UserArgs(val attributes: Output<Map<String, String>>? = null, val clientMetadata: Output<Map<String, String>>? = null, val desiredDeliveryMediums: Output<List<String>>? = null, val enabled: Output<Boolean>? = null, val forceAliasCreation: Output<Boolean>? = null, val messageAction: Output<String>? = null, val password: Output<String>? = null, val temporaryPassword: Output<String>? = null, val userPoolId: Output<String>? = null, val username: Output<String>? = null, val validationData: Output<Map<String, String>>? = null) : ConvertibleToJava<UserArgs>

Provides a Cognito User Resource.

Example Usage

Basic configuration

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.User;
import com.pulumi.aws.cognito.UserArgs;
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 exampleUserPool = new UserPool("exampleUserPool");
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(exampleUserPool.id())
.username("example")
.build());
}
}

Setting user attributes

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.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 exampleUserPool = new UserPool("exampleUserPool", UserPoolArgs.builder()
.schemas(
UserPoolSchemaArgs.builder()
.name("example")
.attributeDataType("Boolean")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.build(),
UserPoolSchemaArgs.builder()
.name("foo")
.attributeDataType("String")
.mutable(false)
.required(false)
.developerOnlyAttribute(false)
.stringAttributeConstraints()
.build())
.build());
var exampleUser = new User("exampleUser", UserArgs.builder()
.userPoolId(exampleUserPool.id())
.username("example")
.attributes(Map.ofEntries(
Map.entry("example", true),
Map.entry("foo", "bar"),
Map.entry("email", "no-reply@domain.example"),
Map.entry("email_verified", true)
))
.build());
}
}

Import

Cognito User can be imported using the user_pool_id/name attributes concatenated, e.g.,

$ pulumi import aws:cognito/user:User user us-east-1_vG78M4goG/user

Constructors

Link copied to clipboard
constructor(attributes: Output<Map<String, String>>? = null, clientMetadata: Output<Map<String, String>>? = null, desiredDeliveryMediums: Output<List<String>>? = null, enabled: Output<Boolean>? = null, forceAliasCreation: Output<Boolean>? = null, messageAction: Output<String>? = null, password: Output<String>? = null, temporaryPassword: Output<String>? = null, userPoolId: Output<String>? = null, username: Output<String>? = null, validationData: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val attributes: Output<Map<String, String>>? = null

A map that contains user attributes and attribute values to be set for the user.

Link copied to clipboard
val clientMetadata: Output<Map<String, String>>? = null

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 client_metadata value. 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.

Link copied to clipboard
val desiredDeliveryMediums: Output<List<String>>? = null

A list of mediums to the welcome message will be sent through. Allowed values are EMAIL and SMS. If it's provided, make sure you have also specified email attribute for the EMAIL medium and phone_number for the SMS. More than one value can be specified. Amazon Cognito does not store the desired_delivery_mediums value. Defaults to ["SMS"].

Link copied to clipboard
val enabled: Output<Boolean>? = null

Specifies whether the user should be enabled after creation. The welcome message will be sent regardless of the enabled value. The behavior can be changed with message_action argument. Defaults to true.

Link copied to clipboard
val forceAliasCreation: Output<Boolean>? = null

If this parameter is set to True and the phone_number or email address specified in the attributes parameter 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 the force_alias_creation value. Defaults to false.

Link copied to clipboard
val messageAction: Output<String>? = null

Set to RESEND to resend the invitation message to a user that already exists and reset the expiration limit on the user's account. Set to SUPPRESS to suppress sending the message. Only one value can be specified. Amazon Cognito does not store the message_action value.

Link copied to clipboard
val password: Output<String>? = null

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 temporary_password value. You can suppress sending the welcome message with the message_action argument. Amazon Cognito does not store the password value. Conflicts with temporary_password.

Link copied to clipboard
val temporaryPassword: Output<String>? = null

The user's temporary password. Conflicts with password.

Link copied to clipboard
val username: Output<String>? = null

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. The following arguments are optional:

Link copied to clipboard
val userPoolId: Output<String>? = null

The user pool ID for the user pool where the user will be created.

Link copied to clipboard
val validationData: Output<Map<String, String>>? = null

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 validation_data value. For more information, see Customizing User Pool Workflows with Lambda Triggers.

Functions

Link copied to clipboard
open override fun toJava(): UserArgs