Class UserPool


  • public class UserPool
    extends com.pulumi.resources.CustomResource
    Provides a Cognito User Pool 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.UserPoolArgs;
     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 pool = new UserPool("pool", UserPoolArgs.builder()
                 .name("mypool")
                 .build());
     
         }
     }
     
     
    ### Enabling SMS and Software Token Multi-Factor Authentication
     
     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.UserPoolSmsConfigurationArgs;
     import com.pulumi.aws.cognito.inputs.UserPoolSoftwareTokenMfaConfigurationArgs;
     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()
                 .smsConfiguration(UserPoolSmsConfigurationArgs.builder()
                     .externalId("example")
                     .snsCallerArn(exampleAwsIamRole.arn())
                     .snsRegion("us-east-1")
                     .build())
                 .softwareTokenMfaConfiguration(UserPoolSoftwareTokenMfaConfigurationArgs.builder()
                     .enabled(true)
                     .build())
                 .mfaConfiguration("ON")
                 .smsAuthenticationMessage("Your code is {####}")
                 .build());
     
         }
     }
     
     
    ### Using Account Recovery Setting
     
     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.UserPoolAccountRecoverySettingArgs;
     import com.pulumi.aws.cognito.inputs.UserPoolAccountRecoverySettingRecoveryMechanismArgs;
     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 test = new UserPool("test", UserPoolArgs.builder()
                 .accountRecoverySetting(UserPoolAccountRecoverySettingArgs.builder()
                     .recoveryMechanisms(                
                         UserPoolAccountRecoverySettingRecoveryMechanismArgs.builder()
                             .name("verified_email")
                             .priority(1)
                             .build(),
                         UserPoolAccountRecoverySettingRecoveryMechanismArgs.builder()
                             .name("verified_phone_number")
                             .priority(2)
                             .build())
                     .build())
                 .name("mypool")
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Cognito User Pools using the `id`. For example: ```sh $ pulumi import aws:cognito/userPool:UserPool pool us-west-2_abc123 ```
    • Constructor Detail

      • UserPool

        public UserPool​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • UserPool

        public UserPool​(java.lang.String name,
                        @Nullable
                        UserPoolArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • UserPool

        public UserPool​(java.lang.String name,
                        @Nullable
                        UserPoolArgs args,
                        @Nullable
                        com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • accountRecoverySetting

        public com.pulumi.core.Output<java.util.Optional<UserPoolAccountRecoverySetting>> accountRecoverySetting()
        Returns:
        Configuration block to define which verified available method a user can use to recover their forgotten password. Detailed below.
      • adminCreateUserConfig

        public com.pulumi.core.Output<UserPoolAdminCreateUserConfig> adminCreateUserConfig()
        Returns:
        Configuration block for creating a new user profile. Detailed below.
      • aliasAttributes

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> aliasAttributes()
        Returns:
        Attributes supported as an alias for this user pool. Valid values: `phoneNumber`, `email`, or `preferredUsername`. Conflicts with `usernameAttributes`.
      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the user pool.
      • autoVerifiedAttributes

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> autoVerifiedAttributes()
        Returns:
        Attributes to be auto-verified. Valid values: `email`, `phoneNumber`.
      • creationDate

        public com.pulumi.core.Output<java.lang.String> creationDate()
        Returns:
        Date the user pool was created.
      • customDomain

        public com.pulumi.core.Output<java.lang.String> customDomain()
        Returns:
        A custom domain name that you provide to Amazon Cognito. This parameter applies only if you use a custom domain to host the sign-up and sign-in pages for your application. For example: `auth.example.com`.
      • deletionProtection

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> deletionProtection()
        Returns:
        When active, DeletionProtection prevents accidental deletion of your user pool. Before you can delete a user pool that you have protected against deletion, you must deactivate this feature. Valid values are `ACTIVE` and `INACTIVE`, Default value is `INACTIVE`.
      • deviceConfiguration

        public com.pulumi.core.Output<java.util.Optional<UserPoolDeviceConfiguration>> deviceConfiguration()
        Returns:
        Configuration block for the user pool's device tracking. Detailed below.
      • domain

        public com.pulumi.core.Output<java.lang.String> domain()
        Returns:
        Holds the domain prefix if the user pool has a domain associated with it.
      • emailConfiguration

        public com.pulumi.core.Output<java.util.Optional<UserPoolEmailConfiguration>> emailConfiguration()
        Returns:
        Configuration block for configuring email. Detailed below.
      • emailMfaConfiguration

        public com.pulumi.core.Output<java.util.Optional<UserPoolEmailMfaConfiguration>> emailMfaConfiguration()
        Returns:
        Configuration block for configuring email Multi-Factor Authentication (MFA); requires at least 2 `accountRecoverySetting` entries; requires an `emailConfiguration` configuration block. Effective only when `mfaConfiguration` is `ON` or `OPTIONAL`. Detailed below.
      • emailVerificationMessage

        public com.pulumi.core.Output<java.lang.String> emailVerificationMessage()
        Returns:
        String representing the email verification message. Conflicts with `verificationMessageTemplate` configuration block `emailMessage` argument.
      • emailVerificationSubject

        public com.pulumi.core.Output<java.lang.String> emailVerificationSubject()
        Returns:
        String representing the email verification subject. Conflicts with `verificationMessageTemplate` configuration block `emailSubject` argument.
      • endpoint

        public com.pulumi.core.Output<java.lang.String> endpoint()
        Returns:
        Endpoint name of the user pool. Example format: `cognito-idp.REGION.amazonaws.com/xxxx_yyyyy`
      • estimatedNumberOfUsers

        public com.pulumi.core.Output<java.lang.Integer> estimatedNumberOfUsers()
        Returns:
        A number estimating the size of the user pool.
      • lambdaConfig

        public com.pulumi.core.Output<java.util.Optional<UserPoolLambdaConfig>> lambdaConfig()
        Returns:
        Configuration block for the AWS Lambda triggers associated with the user pool. Detailed below.
      • lastModifiedDate

        public com.pulumi.core.Output<java.lang.String> lastModifiedDate()
        Returns:
        Date the user pool was last modified.
      • mfaConfiguration

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> mfaConfiguration()
        Returns:
        Multi-Factor Authentication (MFA) configuration for the User Pool. Defaults of `OFF`. Valid values are `OFF` (MFA Tokens are not required), `ON` (MFA is required for all users to sign in; requires at least one of `emailMfaConfiguration`, `smsConfiguration` or `softwareTokenMfaConfiguration` to be configured), or `OPTIONAL` (MFA Will be required only for individual users who have MFA Enabled; requires at least one of `emailMfaConfiguration`, `smsConfiguration` or `softwareTokenMfaConfiguration` to be configured).
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the user pool.
      • passwordPolicy

        public com.pulumi.core.Output<UserPoolPasswordPolicy> passwordPolicy()
        Returns:
        Configuration block for information about the user pool password policy. Detailed below.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • schemas

        public com.pulumi.core.Output<java.util.Optional<java.util.List<UserPoolSchema>>> schemas()
        Returns:
        Configuration block for the schema attributes of a user pool. Detailed below. Schema attributes from the [standard attribute set](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) only need to be specified if they are different from the default configuration. Attributes can be added, but not modified or removed. Maximum of 50 attributes.
      • signInPolicy

        public com.pulumi.core.Output<UserPoolSignInPolicy> signInPolicy()
        Returns:
        Configuration block for information about the user pool sign in policy. Detailed below.
      • smsAuthenticationMessage

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> smsAuthenticationMessage()
        Returns:
        String representing the SMS authentication message. The Message must contain the `{####}` placeholder, which will be replaced with the code.
      • smsConfiguration

        public com.pulumi.core.Output<UserPoolSmsConfiguration> smsConfiguration()
        Returns:
        Configuration block for Short Message Service (SMS) settings. Detailed below. These settings apply to SMS user verification and SMS Multi-Factor Authentication (MFA). SMS MFA is activated only when `mfaConfiguration` is set to `ON` or `OPTIONAL` along with this block. Due to Cognito API restrictions, the SMS configuration cannot be removed without recreating the Cognito User Pool. For user data safety, this resource will ignore the removal of this configuration by disabling drift detection. To force resource recreation after this configuration has been applied, see the `taint` command.
      • smsVerificationMessage

        public com.pulumi.core.Output<java.lang.String> smsVerificationMessage()
        Returns:
        String representing the SMS verification message. Conflicts with `verificationMessageTemplate` configuration block `smsMessage` argument.
      • softwareTokenMfaConfiguration

        public com.pulumi.core.Output<java.util.Optional<UserPoolSoftwareTokenMfaConfiguration>> softwareTokenMfaConfiguration()
        Returns:
        Configuration block for software token Mult-Factor Authentication (MFA) settings. Effective only when `mfaConfiguration` is `ON` or `OPTIONAL`. Detailed below.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the User Pool. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • userAttributeUpdateSettings

        public com.pulumi.core.Output<java.util.Optional<UserPoolUserAttributeUpdateSettings>> userAttributeUpdateSettings()
        Returns:
        Configuration block for user attribute update settings. Detailed below.
      • userPoolAddOns

        public com.pulumi.core.Output<java.util.Optional<UserPoolUserPoolAddOns>> userPoolAddOns()
        Returns:
        Configuration block for user pool add-ons to enable user pool advanced security mode features. Detailed below.
      • userPoolTier

        public com.pulumi.core.Output<java.lang.String> userPoolTier()
        Returns:
        The user pool [feature plan](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-sign-in-feature-plans.html), or tier. Valid values: `LITE`, `ESSENTIALS`, `PLUS`.
      • usernameAttributes

        public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> usernameAttributes()
        Returns:
        Whether email addresses or phone numbers can be specified as usernames when a user signs up. Conflicts with `aliasAttributes`.
      • usernameConfiguration

        public com.pulumi.core.Output<UserPoolUsernameConfiguration> usernameConfiguration()
        Returns:
        Configuration block for username configuration. Detailed below.
      • verificationMessageTemplate

        public com.pulumi.core.Output<UserPoolVerificationMessageTemplate> verificationMessageTemplate()
        Returns:
        Configuration block for verification message templates. Detailed below.
      • webAuthnConfiguration

        public com.pulumi.core.Output<java.util.Optional<UserPoolWebAuthnConfiguration>> webAuthnConfiguration()
        Returns:
        Configuration block for web authn configuration. Detailed below.
      • get

        public static UserPool get​(java.lang.String name,
                                   com.pulumi.core.Output<java.lang.String> id,
                                   @Nullable
                                   UserPoolState state,
                                   @Nullable
                                   com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.