Skip to content

Commit eca005a

Browse files
authored
Merge pull request #7 from cruxstack/development
feat: add support for v1 of email-sender
2 parents fb38a7e + 594797d commit eca005a

File tree

3 files changed

+32
-19
lines changed

3 files changed

+32
-19
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Terraform Module: AWS Cognito Custom Message Sender
22

3-
:warning: **This module is not ready for use. Wait until v1.x.x release.**
4-
53
This Terraform module deploys a AWS Lambda function to serve as a custom SMS
64
sender for AWS Cognito. The module uses Open Policy Agent (OPA) policies to
75
determine whether to send an SMS message or not, and can be customized to fit
@@ -43,18 +41,20 @@ other optional variables (e.g., `name`, `tags`, etc.) provided by the
4341
`cloudposse/label/null` module. Please refer to its [documentation](https://registry.terraform.io/modules/cloudposse/label/null/latest)
4442
for more details on these variables.
4543

46-
| Name | Description | Type | Default | Required |
47-
|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:---------:|:--------:|
48-
| `kms_key_alias_prefix` | The prefix for the KMS key alias. It must start with 'alias' and only include alphanumeric characters, dashes, underscores, colons or slashes, but doesn't end with a slash. | `string` | `"alias"` | no |
49-
| `service_log_level` | The log level for the service. It must be one of 'debug', 'info', 'warn', 'error', 'panic' or 'fatal'. | `string` | `"info"` | no |
50-
| `email_sender_version` | Version or git ref of the source code | `string` | `"latest"` | no |
51-
| `email_sender_enabled` | Whether or not the eamil sender is enabled. | `bool` | `false` | no |
52-
| `email_sender_policy_content` | The content of the Open Policy Agent policy for email sender. It must include the string 'package cognito_custom_sender_email_policy'. | `string` | n/a | yes |
53-
| `sms_sender_enabled` | Whether or not the SMS sender is enabled. | `bool` | `false` | no |
54-
| `sms_sender_policy_content` | The content of the Open Policy Agent policy for SMS sender. It must include the string 'package cognito_custom_sender_sms_policy'. | `string` | n/a | yes |
55-
| `sms_sender_throttle_period_in_minutes` | The throttle period for the SMS sender, in minutes. It must be a positive integer. | `number` | `15` | no |
56-
| `aws_account_id` | The AWS account ID that the module will be deployed in. | `string` | `""` | no |
57-
| `aws_region_name` | The AWS region name where the module will be deployed. | `string` | `""` | no |
44+
| Name | Description | Type | Default | Required |
45+
|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:|:--------:|
46+
| `kms_key_alias_prefix` | The prefix for the KMS key alias. | `string` | `"alias"` | no |
47+
| `service_log_level` | The log level for the service. It must be one of 'debug', 'info', 'warn', 'error', 'panic' or 'fatal'. | `string` | `"info"` | no |
48+
| `email_sender_version` | Version or git ref of the source code | `string` | `"latest"` | no |
49+
| `email_sender_enabled` | Whether or not the eamil sender is enabled. | `bool` | `false` | no |
50+
| `email_sender_policy_content` | The content of the Open Policy Agent policy for email sender. It must include the string 'package cognito_custom_sender_email_policy'. | `string` | n/a | yes |
51+
| `sendgrid_api_key` | The SendGrid API key used to interact with its API. | `string` | `""` | no |
52+
| `sendgrid_email_verification_enabled` | Toggle to use email verification. | `bool` | `false` | no |
53+
| `sms_sender_enabled` | Whether or not the SMS sender is enabled. | `bool` | `false` | no |
54+
| `sms_sender_policy_content` | The content of the Open Policy Agent policy for SMS sender. It must include the string 'package cognito_custom_sender_sms_policy'. | `string` | n/a | yes |
55+
| `sms_sender_throttle_period_in_minutes` | The throttle period for the SMS sender, in minutes. It must be a positive integer. | `number` | `15` | no |
56+
| `aws_account_id` | The AWS account ID that the module will be deployed in. | `string` | `""` | no |
57+
| `aws_region_name` | The AWS region name where the module will be deployed. | `string` | `""` | no |
5858

5959
## Outputs
6060

main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,12 @@ resource "aws_lambda_function" "email_msg_sender" {
354354

355355
environment {
356356
variables = {
357-
DEBUG_MODE = var.email_sender_debug_mode
358-
LOG_LEVEL = var.service_log_level
359-
KMS_KEY_ID = module.kms_key.key_arn
360-
EMAIL_SENDER_ENABLED = local.email_sender_enabled
361-
EMAIL_SENDER_POLICY_PATH = local.email_sender_policy_path
357+
APP_DEBUG_MODE = var.email_sender_debug_mode
358+
APP_LOG_LEVEL = var.service_log_level
359+
APP_KMS_KEY_ID = module.kms_key.key_arn
360+
APP_EMAIL_SENDER_POLICY_PATH = local.email_sender_policy_path
361+
APP_SENDGRID_API_KEY = var.sendgrid_api_key
362+
APP_SENDGRID_EMAIL_VERIFICATION_ENABLED = var.sendgrid_email_verification_enabled
362363
}
363364
}
364365

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ variable "email_sender_policy_content" {
4646
default = ""
4747
}
4848

49+
variable "sendgrid_api_key" {
50+
type = string
51+
description = "The SendGrid API key used to interact with its API."
52+
default = ""
53+
}
54+
55+
variable "sendgrid_email_verification_enabled" {
56+
type = bool
57+
description = "Toggle to use email verification."
58+
default = false
59+
}
60+
4961
# --------------------------------------------------------------- sms-sender ---
5062

5163
variable "sms_sender_enabled" {

0 commit comments

Comments
 (0)