Skip to content

Commit a86221c

Browse files
committed
Add kms_key_identifier property to individual pipes and archives
1 parent 1a71d15 commit a86221c

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

examples/with-archive/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ module "eventbridge" {
5252
module "eventbridge_archive_only" {
5353
source = "../../"
5454

55-
create_bus = false
56-
create_archives = true
57-
kms_key_identifier = module.kms.key_id
55+
create_bus = false
56+
create_archives = true
5857

5958
archives = {
6059
"launch-archive-existing-bus" = {
@@ -67,6 +66,7 @@ module "eventbridge_archive_only" {
6766
"detail-type" : ["EC2 Instance Launch Successful"]
6867
}
6968
)
69+
kms_key_identifier = module.kms.key_id
7070
}
7171
}
7272

examples/with-pipes/main.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,25 @@ module "eventbridge" {
350350
}
351351
}
352352

353+
module "eventbridge_pipe_only" {
354+
source = "../../"
355+
356+
create_bus = false
357+
358+
pipes = {
359+
"pipe-for-existing-bus" = {
360+
source = aws_sqs_queue.source.arn
361+
target = aws_sqs_queue.target.arn
362+
kms_key_identifier = module.kms.key_id
363+
}
364+
365+
tags = {
366+
Pipe = "pipe-for-existing-bus"
367+
}
368+
}
369+
depends_on = [aws_cloudwatch_event_bus.existing_bus]
370+
}
371+
353372
##################
354373
# Extra resources
355374
##################
@@ -358,6 +377,13 @@ resource "random_pet" "this" {
358377
length = 2
359378
}
360379

380+
###############################
381+
# Event Bus
382+
###############################
383+
384+
resource "aws_cloudwatch_event_bus" "existing_bus" {
385+
name = "${random_pet.this.id}-existing-bus"
386+
}
361387

362388
###############################
363389
# API Destination / Connection

main.tf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ resource "aws_cloudwatch_event_archive" "this" {
284284

285285
region = var.region
286286

287-
name = lookup(each.value, "name", each.key)
288-
event_source_arn = try(each.value["event_source_arn"], aws_cloudwatch_event_bus.this[0].arn)
289-
kms_key_identifier = var.kms_key_identifier
287+
name = lookup(each.value, "name", each.key)
288+
event_source_arn = try(each.value["event_source_arn"], aws_cloudwatch_event_bus.this[0].arn)
290289

291-
description = lookup(each.value, "description", null)
292-
event_pattern = lookup(each.value, "event_pattern", null)
293-
retention_days = lookup(each.value, "retention_days", null)
290+
description = lookup(each.value, "description", null)
291+
event_pattern = lookup(each.value, "event_pattern", null)
292+
retention_days = lookup(each.value, "retention_days", null)
293+
kms_key_identifier = lookup(each.value, "kms_key_identifier", null)
294294
}
295295

296296
resource "aws_cloudwatch_event_permission" "this" {
@@ -668,7 +668,7 @@ resource "aws_pipes_pipe" "this" {
668668
source = each.value.source
669669
target = each.value.target
670670

671-
kms_key_identifier = var.kms_key_identifier
671+
kms_key_identifier = lookup(each.value, "kms_key_identifier", null)
672672
description = lookup(each.value, "description", null)
673673
desired_state = lookup(each.value, "desired_state", null)
674674

0 commit comments

Comments
 (0)