Skip to content

Commit 6a499b6

Browse files
authored
feat: Support for existing event buses (#22)
1 parent 558ec5c commit 6a499b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "aws_cloudwatch_event_rule" "this" {
3232
name = each.value.Name
3333
name_prefix = lookup(each.value, "name_prefix", null)
3434

35-
event_bus_name = var.create_bus ? aws_cloudwatch_event_bus.this[0].name : "default"
35+
event_bus_name = var.create_bus ? aws_cloudwatch_event_bus.this[0].name : var.bus_name
3636

3737
description = lookup(each.value, "description", null)
3838
is_enabled = lookup(each.value, "enabled", true)
@@ -50,7 +50,7 @@ resource "aws_cloudwatch_event_target" "this" {
5050
for target in local.eventbridge_targets : target.name => target
5151
} : {}
5252

53-
event_bus_name = var.create_bus ? aws_cloudwatch_event_bus.this[0].name : "default"
53+
event_bus_name = var.create_bus ? aws_cloudwatch_event_bus.this[0].name : var.bus_name
5454

5555
rule = each.value.Name
5656
arn = each.value.arn
@@ -185,5 +185,5 @@ resource "aws_cloudwatch_event_permission" "this" {
185185
statement_id = compact(split(" ", each.key))[1]
186186

187187
action = lookup(each.value, "action", null)
188-
event_bus_name = try(each.value["event_bus_name"], aws_cloudwatch_event_bus.this[0].name, null)
188+
event_bus_name = try(each.value["event_bus_name"], aws_cloudwatch_event_bus.this[0].name, var.bus_name, null)
189189
}

0 commit comments

Comments
 (0)