Skip to content

Commit

Permalink
feat: 5809 batch alarm dlq module (#388)
Browse files Browse the repository at this point in the history
* fix: batch rule names

* docs: update Terraform docs

* fix: add name to targets

* docs: update Terraform docs

* fix: more event renaming

* fix: used dlq module

* docs: update Terraform docs

* fix: updated queue arn

* fix: sqs module version

* docs: update Terraform docs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Wi11Shell and github-actions[bot] authored Oct 14, 2024
1 parent 258431c commit 1637fa9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
3 changes: 1 addition & 2 deletions infra/terraform/modules/service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
| <a name="module_records"></a> [records](#module\_records) | terraform-aws-modules/route53/aws//modules/records | ~> 4.0 |
| <a name="module_route53_records"></a> [route53\_records](#module\_route53\_records) | terraform-aws-modules/acm/aws | ~> 5.0 |
| <a name="module_sns_batch_failure"></a> [sns\_batch\_failure](#module\_sns\_batch\_failure) | terraform-aws-modules/sns/aws | ~> 6.1 |
| <a name="module_sqs_deadletter"></a> [sqs\_deadletter](#module\_sqs\_deadletter) | terraform-aws-modules/sqs/aws | ~> 4.2.1 |

## Resources

Expand All @@ -36,8 +37,6 @@
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_lb_listener_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) | resource |
| [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource |
| [aws_sqs_queue.main](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
| [aws_sqs_queue.sqs-deadletter-queue](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_canonical_user_id.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) | data source |
| [aws_cloudfront_log_delivery_canonical_user_id.cloudfront](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/cloudfront_log_delivery_canonical_user_id) | data source |
Expand Down
24 changes: 10 additions & 14 deletions infra/terraform/modules/service/batch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ module "eventbridge_sns" {
{
name = "batch-fail-event"
arn = module.sns_batch_failure.topic_arn
dead_letter_arn = aws_sqs_queue.sqs-deadletter-queue.arn
dead_letter_arn = module.sqs_deadletter.queue_arn
}
]
}
Expand Down Expand Up @@ -253,21 +253,17 @@ module "sns_batch_failure" {

}

resource "aws_sqs_queue" "main" {
name = "vol-app-${var.environment}-batch-failure-queue"

redrive_policy = jsonencode({
deadletterTargetArn = aws_sqs_queue.sqs-deadletter-queue.arn
maxReceiveCount = 4
})
redrive_allow_policy = jsonencode({
redrivePermission = "byQuery"
sourceQueueArns = [aws_sqs_queue.sqs-deadletter-queue.arn]
})
}
module "sqs_deadletter" {
version = "~> 4.2.1"
source = "terraform-aws-modules/sqs/aws"

resource "aws_sqs_queue" "sqs-deadletter-queue" {
name = "vol-app-${var.environment}-batch-failure-dlq"

create_dlq = true
redrive_policy = {
# default is 5 for this module
maxReceiveCount = 10
}
}

resource "aws_cloudwatch_log_group" "this" {
Expand Down

0 comments on commit 1637fa9

Please sign in to comment.