Skip to content

Commit affb7c7

Browse files
committed
add SMS Notifications files not included on first feature commit
1 parent 57cea50 commit affb7c7

File tree

14 files changed

+137
-3
lines changed

14 files changed

+137
-3
lines changed

infra/modules/notifications-phone-pool/resources/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ locals {
2828
# CloudFormation stack for SMS phone pool and phone number
2929
# Every phone pool must have at least one phone number, so we create both resources in the same stack.
3030
resource "aws_cloudformation_stack" "sms_phone_pool" {
31+
# checkov:skip=CKV_AWS_124: CloudFormation stack event notifications via SNS not required; stack lifecycle is managed by Terraform and errors surface through Terraform output.
3132
name = "${var.name}-phone-pool"
3233

3334
timeout_in_minutes = 5

infra/modules/notifications-sms/resources/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ resource "aws_iam_role_policy" "sms_logging_permissions" {
106106

107107
# CloudFormation stack for SMS configuration set
108108
resource "aws_cloudformation_stack" "sms_config_set" {
109+
# checkov:skip=CKV_AWS_124: CloudFormation stack event notifications via SNS not required; stack lifecycle is managed by Terraform and errors surface through Terraform output.
109110
name = "${var.name}-config-set"
110111

111112
# Use a dedicated service role for CloudFormation operations

infra/networks/main.tf.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ locals {
4848

4949
# Whether any of the applications in the network has enabled notifications
5050
enable_notifications = anytrue([for app in local.apps_in_network : app.enable_notifications])
51+
52+
# Whether any of the applications in the network has enabled SMS notifications
53+
enable_sms_notifications = anytrue([for app in local.apps_in_network : app.enable_sms_notifications])
5154
}
5255

5356
terraform {

infra/project-config/aws_services.tf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,5 @@ locals {
107107

108108
// AWS WAF v2 – An updated web application firewall service for filtering and securing traffic.
109109
"wafv2",
110-
111-
// AWS CloudFormation – Provides infrastructure as code for deploying and managing AWS resources. Used to manage resources that don't have adequate native Terraform support.
112-
"cloudformation",
113110
]
114111
}

infra/{{app_name}}/app-config/dev.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module "dev_config" {
1111
has_incident_management_service = local.has_incident_management_service
1212
enable_notifications = local.enable_notifications
1313
enable_document_data_extraction = local.enable_document_data_extraction
14+
enable_sms_notifications = local.enable_sms_notifications
1415

1516
# Enable and configure identity provider.
1617
enable_identity_provider = local.enable_identity_provider

infra/{{app_name}}/app-config/env-config/notifications.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,17 @@ locals {
1515
# Configure the REPLY-TO email address if it should be different from the sender.
1616
reply_to_email = "notifications@${var.domain_name}"
1717
} : null
18+
sms_config = var.enable_sms_notifications ? {
19+
# SMS configuration name.
20+
name = "${var.app_name}-${var.environment}-sms"
21+
22+
# Type of SMS number to use: "LONG_CODE", "TOLL_FREE". For more information,
23+
# see https://docs.aws.amazon.com/sms-voice/latest/userguide/phone-number-types.html.
24+
sms_number_type = var.sms_number_type
25+
26+
# The AWS End User Messaging Service (EUMS) registration ID to use to provision the sender phone number.
27+
# This is the registration ID provided by AWS when registering the phone number.
28+
sms_sender_phone_number_registration_id = var.sms_sender_phone_number_registration_id
29+
30+
} : null
1831
}

infra/{{app_name}}/app-config/env-config/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ output "notifications_config" {
3434
value = local.notifications_config
3535
}
3636

37+
output "sms_config" {
38+
value = local.sms_config
39+
}
40+
3741
output "storage_config" {
3842
value = {
3943
# Include project name in bucket name since buckets need to be globally unique across AWS

infra/{{app_name}}/app-config/env-config/variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@ variable "enable_identity_provider" {
4343
default = false
4444
}
4545

46+
variable "enable_sms_notifications" {
47+
type = bool
48+
description = "Enables SMS notifications"
49+
default = false
50+
}
51+
52+
variable "sms_number_type" {
53+
type = string
54+
description = "The type of phone number to use for SMS notifications. Must be either 'LONG_CODE', 'TOLL_FREE', 'TEN_DLC', or 'SIMULATOR'."
55+
default = null
56+
}
57+
58+
variable "sms_sender_phone_number_registration_id" {
59+
type = string
60+
description = "The registration ID for the phone number to use as the sender in SMS messages. This value is obtain in AWS and the registration must be in APPROVED or COMPLETE status to be linked."
61+
default = null
62+
}
63+
4664
variable "enable_notifications" {
4765
type = bool
4866
description = "Enables notifications"

infra/{{app_name}}/app-config/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ locals {
4343
# 2. Sets up IAM permissions for the application to send emails
4444
enable_notifications = false
4545

46+
# Whether or not the application should enable SMS notifications via AWS End User Messaging.
47+
# If enabled:
48+
# 1. Creates AWS End User Messaging SMS configuration set
49+
# 2. Sets up IAM permissions for SMS sending
50+
# 3. Configures SMS delivery tracking and opt-out management
51+
enable_sms_notifications = false
52+
4653
# Whether or not the application should enable WAF for the load balancer.
4754
# If enabled:
4855
# 1. Creates an AWS WAF web ACL with AWSManagedRulesCommonRuleSet

infra/{{app_name}}/app-config/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ output "enable_notifications" {
3838
value = local.enable_notifications
3939
}
4040

41+
output "enable_sms_notifications" {
42+
value = local.enable_sms_notifications
43+
}
44+
4145
output "enable_waf" {
4246
value = local.enable_waf
4347
}

0 commit comments

Comments
 (0)