hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

[Enhancement]: Support Email MFA from Cognito User Pools #39735

Open whatnick opened 3 weeks ago

whatnick commented 3 weeks ago

Description

AWS Cognito support Email MFA for login verification, however it is not clear how this is configured and how message templates for email messages for MFA are set.

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

resource "aws_cognito_user_pool" "example" {
  # ... other configuration ...

  mfa_configuration          = "ON"
  sms_authentication_message = "Your code is {####}"
  email_authentication_message = "Your MFA code is {####}"

  sms_configuration {
    external_id    = "example"
    sns_caller_arn = aws_iam_role.example.arn
    sns_region     = "us-east-1"
  }

  email_configuration {
    external_id = "example"
    ses_caller_arn = aws_iam_role.example.arn
    ses_region     = "us-east-1"
  }

  software_token_mfa_configuration {
    enabled = true
  }
}

References

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-advanced-security-email-mfa.html

Would you like to implement a fix?

Yes

github-actions[bot] commented 3 weeks ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

DrFaust92 commented 3 weeks ago

I think you need to use verification_message_template -> default_email_option