Cognito User Pool with SES and Lambda Trigger

I would like to use an Amazon SES account with my Cognito Custom message trigger. When I added the SES to the aws_cognito_user_pool, I get an error saying that ‘CustomMessage invocation failed due to configuration.’ How do I configure this properly?

resource "aws_cognito_user_pool" "main" {
  name = "${var.user_pool_name}_${var.stage}"
  username_attributes = [ "email" ]
  auto_verified_attributes = ["email"]
  schema {
    attribute_data_type = "String"
    mutable             = true
    name                = "name"
    required            = true
  }
  schema {
    attribute_data_type = "String"
    mutable             = true
    name                = "email"
    required            = true
  }

  password_policy {
    minimum_length    = "8"
    require_lowercase = true
    require_numbers   = true
    require_symbols   = true
    require_uppercase = true
  }
  mfa_configuration        = "OFF"

  lambda_config {
    custom_message    = aws_lambda_function.custom_message.arn
    post_confirmation = aws_lambda_function.post_confirmation.arn
  }
  lifecycle {
    ignore_changes = [ schema ]
  }
  email_configuration {
    source_arn = aws_ses_email_identity.identity.arn
    email_sending_account = "DEVELOPER"
  }
}

This is probably a better question for the AWS forums.

1 Like