Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update how sms email templates are config #1

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {####}"
}