Skip to content

Commit 5ccb0fc

Browse files
CCM-10257: Implement Eventpub in Core
1 parent 1b03a39 commit 5ccb0fc

5 files changed

Lines changed: 32 additions & 14 deletions

File tree

infrastructure/modules/eventpub/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
| Name | Description | Type | Default | Required |
1313
|------|-------------|------|---------|:--------:|
14+
| <a name="input_alarm_prefixes"></a> [alarm\_prefixes](#input\_alarm\_prefixes) | Object containing prefixes for alarm descriptions, e.g. 'RELIABILITY:', 'SECURITY:', 'PERFORMANCE:' | <pre>object({<br/> dlq = string<br/> sns_delivery = string<br/> lambda = string<br/> })</pre> | <pre>{<br/> "dlq": null,<br/> "lambda": null,<br/> "sns_delivery": null<br/>}</pre> | no |
1415
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes |
1516
| <a name="input_component"></a> [component](#input\_component) | The name of the terraformscaffold component calling this module | `string` | n/a | yes |
1617
| <a name="input_control_plane_bus_arn"></a> [control\_plane\_bus\_arn](#input\_control\_plane\_bus\_arn) | Data plane event bus arn | `string` | n/a | yes |
1718
| <a name="input_data_plane_bus_arn"></a> [data\_plane\_bus\_arn](#input\_data\_plane\_bus\_arn) | Data plane event bus arn | `string` | n/a | yes |
1819
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | Default tag map for application to all taggable resources in the module | `map(string)` | `{}` | no |
19-
| <a name="input_dlq_alarm_prefix"></a> [dlq\_alarm\_prefix](#input\_dlq\_alarm\_prefix) | Prefix for dlq alarm description - used in Core to trigger Teams Alarms, e.g 'RELIABILITY: ' or 'SECURITY: ' | `string` | `null` | no |
2020
| <a name="input_enable_event_cache"></a> [enable\_event\_cache](#input\_enable\_event\_cache) | Enable caching of events to an S3 bucket | `bool` | `false` | no |
2121
| <a name="input_enable_sns_delivery_logging"></a> [enable\_sns\_delivery\_logging](#input\_enable\_sns\_delivery\_logging) | Enable SNS Delivery Failure Notifications | `bool` | `false` | no |
2222
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the terraformscaffold environment the module is called for | `string` | n/a | yes |
@@ -30,7 +30,6 @@
3030
| <a name="input_name"></a> [name](#input\_name) | A unique name to distinguish this module invocation from others within the same CSI scope | `string` | n/a | yes |
3131
| <a name="input_project"></a> [project](#input\_project) | The name of the terraformscaffold project calling the module | `string` | n/a | yes |
3232
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |
33-
| <a name="input_sns_delivery_alarm_prefix"></a> [sns\_delivery\_alarm\_prefix](#input\_sns\_delivery\_alarm\_prefix) | Prefix for SNS Delivery alarm description - used in Core to trigger Teams Alarms, e.g 'RELIABILITY: ' or 'SECURITY: ' | `string` | `null` | no |
3433
| <a name="input_sns_success_logging_sample_percent"></a> [sns\_success\_logging\_sample\_percent](#input\_sns\_success\_logging\_sample\_percent) | Enable SNS Delivery Successful Sample Percentage | `number` | `0` | no |
3534
## Modules
3635

infrastructure/modules/eventpub/cloudwatch_metric_alarm_dlq_alarm.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_cloudwatch_metric_alarm" "dlq_alarm" {
22
alarm_name = "${local.csi}-dlq-messages-alarm"
3-
alarm_description = "${var.dlq_alarm_prefix} Alarm for messages in the DLQ"
3+
alarm_description = "${var.alarm_prefixes.dlq} Alarm for messages in the DLQ"
44
comparison_operator = "GreaterThanThreshold"
55
evaluation_periods = 1
66
metric_name = "ApproximateNumberOfMessagesVisible"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "aws_cloudwatch_metric_alarm" "lambda_errors" {
2+
alarm_name = "${local.csi}-lambda-errors-alarm"
3+
alarm_description = "${var.alarm_prefixes.lambda} Alarm for Lambda function errors"
4+
comparison_operator = "GreaterThanOrEqualToThreshold"
5+
evaluation_periods = 1
6+
metric_name = "Errors"
7+
namespace = "AWS/Lambda"
8+
period = 300
9+
statistic = "Sum"
10+
threshold = 1
11+
actions_enabled = true
12+
treat_missing_data = "notBreaching"
13+
14+
dimensions = {
15+
FunctionName = aws_lambda_function.main.function_name
16+
}
17+
}

infrastructure/modules/eventpub/cloudwatch_metric_alarm_sns_delivery_failures.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_cloudwatch_metric_alarm" "sns_delivery_failures" {
22
alarm_name = "${local.csi}-sns-delivery-failures"
3-
alarm_description = "${var.sns_delivery_alarm_prefix} Alarm when SNS topic ${aws_sns_topic.main.name} has delivery failures"
3+
alarm_description = "${var.alarm_prefixes.sns_delivery} Alarm when SNS topic ${aws_sns_topic.main.name} has delivery failures"
44
comparison_operator = "GreaterThanThreshold"
55
evaluation_periods = 1
66
metric_name = "NumberOfNotificationsFailed"

infrastructure/modules/eventpub/variables.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ variable "iam_permissions_boundary_arn" {
115115
default = null
116116
}
117117

118-
variable "dlq_alarm_prefix" {
119-
type = string
120-
description = "Prefix for dlq alarm description - used in Core to trigger Teams Alarms, e.g 'RELIABILITY: ' or 'SECURITY: '"
121-
default = null
122-
}
123-
124-
variable "sns_delivery_alarm_prefix" {
125-
type = string
126-
description = "Prefix for SNS Delivery alarm description - used in Core to trigger Teams Alarms, e.g 'RELIABILITY: ' or 'SECURITY: '"
127-
default = null
118+
variable "alarm_prefixes" {
119+
type = object({
120+
dlq = string
121+
sns_delivery = string
122+
lambda = string
123+
})
124+
description = "Object containing prefixes for alarm descriptions, e.g. 'RELIABILITY:', 'SECURITY:', 'PERFORMANCE:'"
125+
default = {
126+
dlq = null
127+
sns_delivery = null
128+
lambda = null
129+
}
128130
}

0 commit comments

Comments
 (0)