Skip to content
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
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Terraform Module: AWS Cognito Custom Message Sender

:warning: **This module is not ready for use. Wait until v1.x.x release.**

This Terraform module deploys a AWS Lambda function to serve as a custom SMS
sender for AWS Cognito. The module uses Open Policy Agent (OPA) policies to
determine whether to send an SMS message or not, and can be customized to fit
Expand Down Expand Up @@ -43,18 +41,20 @@ other optional variables (e.g., `name`, `tags`, etc.) provided by the
`cloudposse/label/null` module. Please refer to its [documentation](https://registry.terraform.io/modules/cloudposse/label/null/latest)
for more details on these variables.

| Name | Description | Type | Default | Required |
|-----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:---------:|:--------:|
| `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 |
| `service_log_level` | The log level for the service. It must be one of 'debug', 'info', 'warn', 'error', 'panic' or 'fatal'. | `string` | `"info"` | no |
| `email_sender_version` | Version or git ref of the source code | `string` | `"latest"` | no |
| `email_sender_enabled` | Whether or not the eamil sender is enabled. | `bool` | `false` | no |
| `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 |
| `sms_sender_enabled` | Whether or not the SMS sender is enabled. | `bool` | `false` | no |
| `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 |
| `sms_sender_throttle_period_in_minutes` | The throttle period for the SMS sender, in minutes. It must be a positive integer. | `number` | `15` | no |
| `aws_account_id` | The AWS account ID that the module will be deployed in. | `string` | `""` | no |
| `aws_region_name` | The AWS region name where the module will be deployed. | `string` | `""` | no |
| Name | Description | Type | Default | Required |
|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|:--------:|:----------:|:--------:|
| `kms_key_alias_prefix` | The prefix for the KMS key alias. | `string` | `"alias"` | no |
| `service_log_level` | The log level for the service. It must be one of 'debug', 'info', 'warn', 'error', 'panic' or 'fatal'. | `string` | `"info"` | no |
| `email_sender_version` | Version or git ref of the source code | `string` | `"latest"` | no |
| `email_sender_enabled` | Whether or not the eamil sender is enabled. | `bool` | `false` | no |
| `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 |
| `sendgrid_api_key` | The SendGrid API key used to interact with its API. | `string` | `""` | no |
| `sendgrid_email_verification_enabled` | Toggle to use email verification. | `bool` | `false` | no |
| `sms_sender_enabled` | Whether or not the SMS sender is enabled. | `bool` | `false` | no |
| `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 |
| `sms_sender_throttle_period_in_minutes` | The throttle period for the SMS sender, in minutes. It must be a positive integer. | `number` | `15` | no |
| `aws_account_id` | The AWS account ID that the module will be deployed in. | `string` | `""` | no |
| `aws_region_name` | The AWS region name where the module will be deployed. | `string` | `""` | no |

## Outputs

Expand Down
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,12 @@ resource "aws_lambda_function" "email_msg_sender" {

environment {
variables = {
DEBUG_MODE = var.email_sender_debug_mode
LOG_LEVEL = var.service_log_level
KMS_KEY_ID = module.kms_key.key_arn
EMAIL_SENDER_ENABLED = local.email_sender_enabled
EMAIL_SENDER_POLICY_PATH = local.email_sender_policy_path
APP_DEBUG_MODE = var.email_sender_debug_mode
APP_LOG_LEVEL = var.service_log_level
APP_KMS_KEY_ID = module.kms_key.key_arn
APP_EMAIL_SENDER_POLICY_PATH = local.email_sender_policy_path
APP_SENDGRID_API_KEY = var.sendgrid_api_key
APP_SENDGRID_EMAIL_VERIFICATION_ENABLED = var.sendgrid_email_verification_enabled
}
}

Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ variable "email_sender_policy_content" {
default = ""
}

variable "sendgrid_api_key" {
type = string
description = "The SendGrid API key used to interact with its API."
default = ""
}

variable "sendgrid_email_verification_enabled" {
type = bool
description = "Toggle to use email verification."
default = false
}

# --------------------------------------------------------------- sms-sender ---

variable "sms_sender_enabled" {
Expand Down