Skip to content

Commit b7dadc0

Browse files
authoredSep 5, 2024··
feat: Adding kms_key_identifierto aws_cloudwatch_event_bus and log_configuration.include_execution_data to aws_pipes_pipe (#132)
1 parent 5063097 commit b7dadc0

File tree

25 files changed

+97
-38
lines changed

25 files changed

+97
-38
lines changed
 

‎README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,13 @@ module "eventbridge" {
381381
| Name | Version |
382382
|------|---------|
383383
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
384-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
384+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
385385

386386
## Providers
387387

388388
| Name | Version |
389389
|------|---------|
390-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
390+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
391391

392392
## Modules
393393

@@ -507,6 +507,7 @@ No modules.
507507
| <a name="input_event_source_name"></a> [event\_source\_name](#input\_event\_source\_name) | The partner event source that the new event bus will be matched with. Must match name. | `string` | `null` | no |
508508
| <a name="input_kinesis_firehose_target_arns"></a> [kinesis\_firehose\_target\_arns](#input\_kinesis\_firehose\_target\_arns) | The Amazon Resource Name (ARN) of the Kinesis Firehose Delivery Streams you want to use as EventBridge targets | `list(string)` | `[]` | no |
509509
| <a name="input_kinesis_target_arns"></a> [kinesis\_target\_arns](#input\_kinesis\_target\_arns) | The Amazon Resource Name (ARN) of the Kinesis Streams you want to use as EventBridge targets | `list(string)` | `[]` | no |
510+
| <a name="input_kms_key_identifier"></a> [kms\_key\_identifier](#input\_kms\_key\_identifier) | The identifier of the AWS KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt events on this event bus. The identifier can be the key Amazon Resource Name (ARN), KeyId, key alias, or key alias ARN. | `string` | `null` | no |
510511
| <a name="input_lambda_target_arns"></a> [lambda\_target\_arns](#input\_lambda\_target\_arns) | The Amazon Resource Name (ARN) of the Lambda Functions you want to use as EventBridge targets | `list(string)` | `[]` | no |
511512
| <a name="input_number_of_policies"></a> [number\_of\_policies](#input\_number\_of\_policies) | Number of policies to attach to IAM role | `number` | `0` | no |
512513
| <a name="input_number_of_policy_jsons"></a> [number\_of\_policy\_jsons](#input\_number\_of\_policy\_jsons) | Number of policies JSON to attach to IAM role | `number` | `0` | no |

‎examples/api-gateway-event-source/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/api-gateway-event-source/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/complete/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3232
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3333
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3434

‎examples/complete/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/default-bus/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/default-bus/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-api-destination/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/with-api-destination/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-archive/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/with-archive/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-ecs-scheduling/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/with-ecs-scheduling/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-lambda-scheduling/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

‎examples/with-lambda-scheduling/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-permissions/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2525

2626
## Providers
2727

2828
| Name | Version |
2929
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
30+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3131
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3232

3333
## Modules

‎examples/with-permissions/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-pipes/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3232
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3333
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3434

@@ -39,6 +39,7 @@ Note that this example may create resources which cost money. Run `terraform des
3939
| <a name="module_eventbridge"></a> [eventbridge](#module\_eventbridge) | ../../ | n/a |
4040
| <a name="module_firehose_to_s3"></a> [firehose\_to\_s3](#module\_firehose\_to\_s3) | terraform-aws-modules/iam/aws//modules/iam-assumable-role | ~> 5.0 |
4141
| <a name="module_firehose_to_s3_policy"></a> [firehose\_to\_s3\_policy](#module\_firehose\_to\_s3\_policy) | terraform-aws-modules/iam/aws//modules/iam-policy | ~> 5.0 |
42+
| <a name="module_kms"></a> [kms](#module\_kms) | terraform-aws-modules/kms/aws | ~> 2.0 |
4243
| <a name="module_lambda_target"></a> [lambda\_target](#module\_lambda\_target) | terraform-aws-modules/lambda/aws | ~> 6.0 |
4344
| <a name="module_logs_bucket"></a> [logs\_bucket](#module\_logs\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 4.0 |
4445
| <a name="module_step_function_target"></a> [step\_function\_target](#module\_step\_function\_target) | terraform-aws-modules/step-functions/aws | ~> 2.0 |
@@ -66,6 +67,7 @@ Note that this example may create resources which cost money. Run `terraform des
6667
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
6768
| [aws_iam_policy_document.assume_role_pipe](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6869
| [aws_iam_policy_document.firehose_to_s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
70+
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
6971

7072
## Inputs
7173

‎examples/with-pipes/main.tf

+51-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ provider "aws" {
88
}
99

1010
data "aws_caller_identity" "current" {}
11+
data "aws_region" "current" {}
1112

1213
module "eventbridge" {
1314
source = "../../"
1415

15-
create_bus = true
16-
bus_name = "example"
16+
create_bus = true
17+
bus_name = "example"
18+
kms_key_identifier = module.kms.key_arn
1719

1820
create_api_destinations = true
1921
create_connections = true
@@ -104,7 +106,8 @@ module "eventbridge" {
104106
}
105107

106108
log_configuration = {
107-
level = "TRACE"
109+
level = "TRACE"
110+
include_execution_data = ["ALL"]
108111
cloudwatch_logs_log_destination = {
109112
log_group_arn = aws_cloudwatch_log_group.logs.arn
110113
}
@@ -575,3 +578,48 @@ data "aws_iam_policy_document" "firehose_to_s3" {
575578
]
576579
}
577580
}
581+
582+
module "kms" {
583+
source = "terraform-aws-modules/kms/aws"
584+
version = "~> 2.0"
585+
description = "KMS key for cross region automated backups replication"
586+
587+
# Aliases
588+
aliases = ["test"]
589+
aliases_use_name_prefix = true
590+
key_statements = [
591+
{
592+
sid = "Allow eventbridge"
593+
principals = [
594+
{
595+
type = "Service"
596+
identifiers = ["events.amazonaws.com"]
597+
}
598+
]
599+
actions = [
600+
"kms:DescribeKey",
601+
"kms:GenerateDataKey",
602+
"kms:Decrypt"
603+
]
604+
resources = ["*"]
605+
conditions = [
606+
{
607+
test = "StringEquals"
608+
variable = "kms:EncryptionContext:aws:events:event-bus:arn"
609+
values = [
610+
"arn:aws:events:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:event-bus/example",
611+
]
612+
},
613+
{
614+
test = "StringEquals"
615+
variable = "aws:SourceArn"
616+
values = [
617+
"arn:aws:events:${data.aws_region.current.id}:${data.aws_caller_identity.current.account_id}:event-bus/example",
618+
]
619+
}
620+
]
621+
}
622+
]
623+
624+
key_owners = [data.aws_caller_identity.current.arn]
625+
}

‎examples/with-pipes/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎examples/with-schedules/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
2020
| Name | Version |
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.53 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.61 |
2424
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2.0 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.0 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.53 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.61 |
3232
| <a name="provider_null"></a> [null](#provider\_null) | >= 2.0 |
3333
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.0 |
3434

‎examples/with-schedules/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
random = {
1010
source = "hashicorp/random"

‎main.tf

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ data "aws_cloudwatch_event_bus" "this" {
6464
resource "aws_cloudwatch_event_bus" "this" {
6565
count = var.create && var.create_bus ? 1 : 0
6666

67-
name = var.bus_name
68-
event_source_name = try(var.event_source_name, null)
67+
name = var.bus_name
68+
event_source_name = var.event_source_name
69+
kms_key_identifier = var.kms_key_identifier
6970

7071
tags = var.tags
7172
}
@@ -781,7 +782,8 @@ resource "aws_pipes_pipe" "this" {
781782
dynamic "log_configuration" {
782783
for_each = try([each.value.log_configuration], [])
783784
content {
784-
level = log_configuration.value.level
785+
include_execution_data = try(log_configuration.value.include_execution_data, null)
786+
level = log_configuration.value.level
785787

786788
dynamic "cloudwatch_logs_log_destination" {
787789
for_each = try([log_configuration.value.cloudwatch_logs_log_destination], [])

‎variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ variable "event_source_name" {
126126
default = null
127127
}
128128

129+
variable "kms_key_identifier" {
130+
description = "The identifier of the AWS KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt events on this event bus. The identifier can be the key Amazon Resource Name (ARN), KeyId, key alias, or key alias ARN."
131+
type = string
132+
default = null
133+
}
134+
129135
variable "schemas_discoverer_description" {
130136
description = "Default schemas discoverer description"
131137
type = string

‎versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.53"
7+
version = ">= 5.61"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)
Please sign in to comment.