@@ -46,10 +46,54 @@ variable "email_sender_policy_content" {
4646 default = " "
4747}
4848
49+ variable "email_sender_providers" {
50+ type = list (string )
51+ description = " List of enabled email providers."
52+ default = [" ses" ]
53+
54+ validation {
55+ condition = length (var. email_sender_providers )
56+ error_message = " Must define exactly one email provider. Support for more than one coming the future."
57+ }
58+
59+ validation {
60+ condition = alltrue ([for x in var . email_sender_providers : contains ([" ses" , " sendgrid" ], x)])
61+ error_message = " Invalid email provider"
62+ }
63+
64+ validation {
65+ condition = ! contains (var. email_sender_providers , " sendgrid" ) || (contains (var. email_sender_providers , " sendgrid" ) && length (var. sendgrid_email_send_api_key ) > 0 )
66+ error_message = " SendGrid is set as email provider but its API is not set."
67+ }
68+ }
69+
4970variable "sendgrid_api_key" {
5071 type = string
51- description = " The SendGrid API key used to interact with its API."
72+ description = " Deprecated: Use sendgrid_email_send_api_key"
73+ default = " "
74+ }
75+
76+ variable "sendgrid_email_send_api_key" {
77+ type = string
78+ description = " The SendGrid API key used to interact with its Mail Send API."
79+ default = " "
80+ }
81+
82+ variable "sendgrid_email_verification_api_key" {
83+ type = string
84+ description = " The SendGrid API key used to interact with its Email Verification API."
5285 default = " "
86+
87+ validation {
88+ condition = ! var. sendgrid_email_verification_enabled || (var. sendgrid_email_verification_enabled && length (" ${ var . sendgrid_email_verification_api_key } ${ var . sendgrid_api_key } " ) > 0 )
89+ error_message = " SendGrid Email Verification is enabled but API Key is not set."
90+ }
91+ }
92+
93+ variable "sendgrid_email_verification_allowlist" {
94+ type = list (string )
95+ description = " List of email domains that bypass email validation."
96+ default = []
5397}
5498
5599variable "sendgrid_email_verification_enabled" {
0 commit comments