Skip to content

Commit 41e4cee

Browse files
committed
feat: allow to pass prefix for rule names
1 parent a8e0de0 commit 41e4cee

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

modules/karpenter/main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,14 @@ locals {
256256
}
257257
}
258258
}
259+
260+
rule_name_prefix = coalesce(var.rule_name_prefix, "Karpenter")
259261
}
260262

261263
resource "aws_cloudwatch_event_rule" "this" {
262264
for_each = { for k, v in local.events : k => v if local.enable_spot_termination }
263265

264-
name_prefix = "Karpenter${each.value.name}-"
266+
name_prefix = "${local.rule_name_prefix}${each.value.name}-"
265267
description = each.value.description
266268
event_pattern = jsonencode(each.value.event_pattern)
267269

modules/karpenter/variables.tf

+10
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,13 @@ variable "create_instance_profile" {
224224
type = bool
225225
default = true
226226
}
227+
228+
################################################################################
229+
# Event Bridge Rules
230+
################################################################################
231+
232+
variable "rule_name_prefix" {
233+
description = "Prefix used for all event bridge rules"
234+
type = string
235+
default = null
236+
}

0 commit comments

Comments
 (0)