Skip to content

Commit

Permalink
feat: update how sms email templates are config
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtoj committed Dec 28, 2023
1 parent e7b5d6e commit 760d7f2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ resource "aws_cognito_user_pool" "this" {
name = module.cognito_userpool_label.id
alias_attributes = var.alias_attributes
auto_verified_attributes = var.auto_verified_attributes
email_verification_subject = coalesce(var.email_verification_subject, var.admin_create_user_config.email_subject)
email_verification_message = coalesce(var.email_verification_message, var.admin_create_user_config.email_message)
email_verification_subject = coalesce(var.email_verification_subject, var.email_config.verification_subject, var.admin_create_user_config.email_subject)
email_verification_message = coalesce(var.email_verification_message, var.email_config.verification_message, var.admin_create_user_config.email_message)
mfa_configuration = upper(var.mfa_config)
sms_authentication_message = var.sms_authentication_message
sms_verification_message = var.sms_verification_message
sms_authentication_message = coalesce(var.sms_authentication_message, var.sms_config.authentication_message)
sms_verification_message = coalesce(var.sms_verification_message, var.sms_config.verification_message)
username_attributes = var.username_attributes
deletion_protection = var.deletion_protection ? "ACTIVE" : "INACTIVE"

Expand Down
58 changes: 31 additions & 27 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ variable "email_config" {
default = {}
}

variable "email_verification_message" {
type = string
description = "A string representing the email verification message"
default = ""
}

variable "email_verification_subject" {
type = string
description = "A string representing the email verification subject"
default = ""
}

variable "admin_create_user_config" {
type = object({
allow_admin_create_user_only = optional(bool, true)
Expand Down Expand Up @@ -154,26 +142,16 @@ variable "recovery_mechanisms" {

variable "sms_config" {
type = object({
enabled = optional(bool, false)
external_id = optional(string, "")
sns_caller_arn = optional(string, "")
enabled = optional(bool, false)
external_id = optional(string, "")
sns_caller_arn = optional(string, "")
authentication_message = optional(string, "Your code is {####}")
verification_message = optional(string, "Your code is {####}")
})
description = "Configuration for SMS"
default = {}
}

variable "sms_authentication_message" {
type = string
description = "A string representing the SMS authentication message."
default = "Your code is {####}"
}

variable "sms_verification_message" {
type = string
description = "A string representing the SMS verification message."
default = "Your code is {####}"
}

variable "software_token_mfa_config" {
type = object({
enabled = optional(bool, false)
Expand Down Expand Up @@ -242,3 +220,29 @@ variable "verification_message_template" {
description = "Configuration for verification message templates."
default = {}
}

# =================================================================== deprecated ===

variable "email_verification_message" {
type = string
description = "A string representing the email verification message"
default = ""
}

variable "email_verification_subject" {
type = string
description = "A string representing the email verification subject"
default = ""
}

variable "sms_authentication_message" {
type = string
description = "A string representing the SMS authentication message."
default = "Your code is {####}"
}

variable "sms_verification_message" {
type = string
description = "A string representing the SMS verification message."
default = "Your code is {####}"
}

0 comments on commit 760d7f2

Please sign in to comment.