» Resource: aws_cognito_user_pool

Provides a Cognito User Pool resource.

» Example Usage

» Basic configuration

resource "aws_cognito_user_pool" "pool" {
  name = "mypool"
}

» Argument Reference

The following arguments are supported:

» Admin Create User Config

» Invite Message template
  • email_message (Optional) - The message template for email messages. Must contain {username} and {####} placeholders, for username and temporary password, respectively.
  • email_subject (Optional) - The subject line for email messages.
  • sms_message (Optional) - The message template for SMS messages. Must contain {username} and {####} placeholders, for username and temporary password, respectively.

» Device Configuration

» Email Configuration

» Lambda Configuration

» Password Policy

  • minimum_length (Optional) - The minimum length of the password policy that you have set.
  • require_lowercase (Optional) - Whether you have required users to use at least one lowercase letter in their password.
  • require_numbers (Optional) - Whether you have required users to use at least one number in their password.
  • require_symbols (Optional) - Whether you have required users to use at least one symbol in their password.
  • require_uppercase (Optional) - Whether you have required users to use at least one uppercase letter in their password.

» Schema Attributes

» Defaults for Standard Attributes

The standard attributes have the following defaults. Note that attributes which match the default values are not stored in Terraform state when importing.

schema {
  name                     = <name>
  attribute                = <appropriate type>
  developer_only_attribute = false
  mutable                  = true  // false for "sub"
  required                 = false // true for "sub"
  string_attribute_constraints { // if it's a string
    min_length = 0    // 10 for "birthdate"
    max_length = 2048 // 10 for "birthdate"
  }
}
» Number Attribute Constraints
  • max_value (Optional) - The maximum value of an attribute that is of the number data type.
  • min_value (Optional) - The minimum value of an attribute that is of the number data type.
» String Attribute Constraints
  • max_length (Optional) - The maximum length of an attribute value of the string type.
  • min_length (Optional) - The minimum length of an attribute value of the string type.

» SMS Configuration

» User Pool Add-ons

» Verification Message Template

  • default_email_option (Optional) - The default email option. Must be either CONFIRM_WITH_CODE or CONFIRM_WITH_LINK. Defaults to CONFIRM_WITH_CODE.
  • email_message (Optional) - The email message template. Must contain the {####} placeholder. Conflicts with email_verification_message argument.
  • email_message_by_link (Optional) - The email message template for sending a confirmation link to the user, it must contain the {##Click Here##} placeholder.
  • email_subject (Optional) - The subject line for the email message template. Conflicts with email_verification_subject argument.
  • email_subject_by_link (Optional) - The subject line for the email message template for sending a confirmation link to the user.
  • sms_message (Optional) - The SMS message template. Must contain the {####} placeholder. Conflicts with sms_verification_message argument.

» Attribute Reference

In addition to all arguments above, the following attributes are exported:

  • id - The id of the user pool.
  • arn - The ARN of the user pool.
  • endpoint - The endpoint name of the user pool. Example format: cognito-idp.REGION.amazonaws.com/xxxx_yyyyy
  • creation_date - The date the user pool was created.
  • last_modified_date - The date the user pool was last modified.

» Import

Cognito User Pools can be imported using the id, e.g.

$ terraform import aws_cognito_user_pool.pool <id>