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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023-2025 Dave Hall
Copyright (c) 2023-2026 Dave Hall, https://proactiveops.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ module "eventbus_dlq_example" {
source = "git::ssh://git@github.com/proactiveops/eventbus//modules/dlq?ref=main"

queue_name = "[sub-name]-[optional-rule-name]" # Must not exceed 60 characters as the module appends "-dlq" to the name
kms_key_id = aws_kms_key.my_key.id # omit if you want a new KMS key to be created.
kms_key_id = aws_kms_key.my_key.id # The key is required. If needed, create a new one and pass it to the module.
tags = var.tags
}

Expand All @@ -220,13 +220,13 @@ EventBus++ is built and maintained by [ProactiveOps](https://proactiveops.com/).
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0, < 2.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0, <6.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0, <7.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.94.1 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0, <7.0 |

## Modules

Expand Down
2 changes: 2 additions & 0 deletions event_bus.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

resource "aws_cloudwatch_event_bus" "this" {
name = local.namespace

Expand Down
2 changes: 2 additions & 0 deletions event_bus_iam.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

data "aws_iam_policy_document" "event_bus" {
statement {
sid = "iamManageBus"
Expand Down
2 changes: 2 additions & 0 deletions event_bus_rules.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

resource "aws_cloudwatch_event_rule" "targets" {
for_each = { for index, rule in var.cross_bus_rules : rule.name => rule }

Expand Down
23 changes: 19 additions & 4 deletions examples/full/main.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
/**
* Example of using EventBus++ module with multiple event buses and cross-bus rules.
*/
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

resource "aws_kms_key" "this" {
description = "EvenBus Example"

deletion_window_in_days = 14
enable_key_rotation = true

tags = local.tags
}

resource "aws_kms_alias" "this" {
name = "alias/eventbus-example"
target_key_id = aws_kms_key.this.key_id
}

module "eventbus_dlq_example" {
source = "../../modules/dlq"

kms_key_id = aws_kms_alias.this.arn
queue_name = "example"
tags = local.tags

tags = local.tags
}

module "eventbus_partner" {
source = "../../"

# Note: Zendesk no longer supports EventBridge partnet buses.
name = "aws.partner/zendesk.com/12345678/default"

cross_bus_rules = [
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

data "aws_caller_identity" "current" {}

data "aws_partition" "current" {}
14 changes: 5 additions & 9 deletions modules/dlq/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<!-- BEGIN_TF_DOCS -->
# EventBus Dead Letter Queue (DLQ) Sub Module

This module creates a SQS queue that can be used by Amazon EventBridge as a DLQ.

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0, < 2.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0, <7.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0, <7.0 |

## Modules

Expand All @@ -24,19 +24,15 @@ No modules.

| Name | Type |
|------|------|
| [aws_kms_alias.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource |
| [aws_kms_key.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
| [aws_sqs_queue.dlq](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
| [aws_sqs_queue_policy.dlq](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue_policy) | resource |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.dlq](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.kms](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_kms_key_id"></a> [kms\_key\_id](#input\_kms\_key\_id) | The ID of the existing KMS key. If empty, then a new key will be created with permissions for EventBridge. | `string` | `""` | no |
| <a name="input_kms_key_id"></a> [kms\_key\_id](#input\_kms\_key\_id) | The ID of the existing KMS key. | `string` | n/a | yes |
| <a name="input_queue_name"></a> [queue\_name](#input\_queue\_name) | The name of the queue to create. -dlq will be appended to the end. The name should the [bus-name]-[rule-name] convention. | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Tags help you manage, identify, organize search and filter resources. | `map(string)` | n/a | yes |

Expand Down
46 changes: 0 additions & 46 deletions modules/dlq/kms.tf

This file was deleted.

6 changes: 0 additions & 6 deletions modules/dlq/main.tf

This file was deleted.

4 changes: 3 additions & 1 deletion modules/dlq/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

output "arn" {
value = aws_sqs_queue.dlq.arn
description = "The ARN of the dead letter queue."
}

output "kms_id" {
value = local.kms_key_id
value = var.kms_key_id
description = "The ID of the KMS used by the queue."
}
8 changes: 5 additions & 3 deletions modules/dlq/sqs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

resource "aws_sqs_queue" "dlq" {
name = "${var.queue_name}-dlq"

Expand All @@ -6,7 +8,7 @@ resource "aws_sqs_queue" "dlq" {
receive_wait_time_seconds = 0
max_message_size = 262144

kms_master_key_id = local.kms_key_id
kms_master_key_id = var.kms_key_id

tags = var.tags
}
Expand All @@ -26,7 +28,7 @@ data "aws_iam_policy_document" "dlq" {
}

dynamic "statement" {
for_each = local.kms_count == 1 ? [1] : []
for_each = var.kms_key_id == null ? [1] : []
content {
sid = "events-policy"
effect = "Allow"
Expand All @@ -39,7 +41,7 @@ data "aws_iam_policy_document" "dlq" {
identifiers = ["events.amazonaws.com"]
}
resources = [
local.kms_key_id
var.kms_key_id
]
}
}
Expand Down
10 changes: 3 additions & 7 deletions modules/dlq/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

variable "kms_key_id" {
description = "The ID of the existing KMS key. If empty, then a new key will be created with permissions for EventBridge."
description = "The ID of the existing KMS key."
type = string
default = ""
}

variable "queue_name" {
Expand All @@ -13,8 +14,3 @@ variable "tags" {
description = "Tags help you manage, identify, organize search and filter resources."
type = map(string)
}

locals {
kms_count = var.kms_key_id == "" ? 1 : 0
kms_key_id = local.kms_count == 1 ? aws_kms_key.this[0].id : var.kms_key_id
}
4 changes: 3 additions & 1 deletion modules/dlq/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

terraform {
required_version = ">= 1.0"
required_version = ">= 1.0, < 2.0"

required_providers {
aws = {
Expand Down
1 change: 1 addition & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

output "bus" {
value = aws_cloudwatch_event_bus.this
Expand Down
2 changes: 2 additions & 0 deletions schema_discovery.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

resource "aws_schemas_discoverer" "this" {
count = var.enable_schema_discovery_registry ? 1 : 0

Expand Down
2 changes: 2 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

variable "name" {
description = "The name of the eventbus or partner source. This must be unique per region per account."
type = string
Expand Down
2 changes: 2 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright 2023 - 2026 Dave Hall, https://proactiveops.io, MIT License

terraform {
required_version = ">= 1.0, < 2.0"

Expand Down