This template creates an AWS Cognito user pool, a user, and a user group, and adds the user to the group.

Terraform Template

resource "aws_cognito_user" "example" {
  user_pool_id = aws_cognito_user_pool.example.id
  username = "example"
}

resource "aws_cognito_user_group" "example" {
  name = "example"
  user_pool_id = aws_cognito_user_pool.example.id
}

resource "aws_cognito_user_in_group" "example" {
  group_name = aws_cognito_user_group.example.name
  user_pool_id = aws_cognito_user_pool.example.id
  username = aws_cognito_user.example.username
}

resource "aws_cognito_user_pool" "example" {
  name = "example"

  password_policy {
    minimum_length = 6
    require_numbers = false
    require_symbols = false
    require_uppercase = false
    temporary_password_validity_days = 7
  }
}