From d1cb68b46d09e491b1fd7050937e565b74fa4d82 Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 14 Jul 2022 16:14:03 +0300 Subject: [PATCH 1/8] add option to remove '-rule' from name of the rule --- main.tf | 8 ++++---- variables.tf | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index 1e107e7..0614c8c 100644 --- a/main.tf +++ b/main.tf @@ -3,7 +3,7 @@ locals { for index, rule in var.rules : merge(rule, { "name" = index - "Name" = "${replace(index, "_", "-")}-rule" + "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index }) ]) eventbridge_targets = flatten([ @@ -11,7 +11,7 @@ locals { for target in var.targets[index] : merge(target, { "rule" = index - "Name" = "${replace(index, "_", "-")}-rule" + "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index }) ] if length(var.targets) != 0 ]) @@ -19,14 +19,14 @@ locals { for index, conn in var.connections : merge(conn, { "name" = index - "Name" = "${replace(index, "_", "-")}-connection" + "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index }) ]) eventbridge_api_destinations = flatten([ for index, dest in var.api_destinations : merge(dest, { "name" = index - "Name" = "${replace(index, "_", "-")}-destination" + "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index }) ]) } diff --git a/variables.tf b/variables.tf index ab618af..1d1a3ba 100644 --- a/variables.tf +++ b/variables.tf @@ -10,6 +10,12 @@ variable "create_role" { default = true } +variable "append_rule_name" { + description = "Controls whether to append '-rule' to the name of the rule" + type = bool + default = true +} + variable "create_bus" { description = "Controls whether EventBridge Bus resource should be created" type = bool From 2544d2920d883b38416303d0ae76f305ca1333cc Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 14 Jul 2022 16:55:25 +0300 Subject: [PATCH 2/8] fix --- main.tf | 8 ++++---- variables.tf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.tf b/main.tf index 0614c8c..ad74d17 100644 --- a/main.tf +++ b/main.tf @@ -3,7 +3,7 @@ locals { for index, rule in var.rules : merge(rule, { "name" = index - "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index }) ]) eventbridge_targets = flatten([ @@ -11,7 +11,7 @@ locals { for target in var.targets[index] : merge(target, { "rule" = index - "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index }) ] if length(var.targets) != 0 ]) @@ -19,14 +19,14 @@ locals { for index, conn in var.connections : merge(conn, { "name" = index - "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index }) ]) eventbridge_api_destinations = flatten([ for index, dest in var.api_destinations : merge(dest, { "name" = index - "Name" = var.append_rule_name ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index }) ]) } diff --git a/variables.tf b/variables.tf index 1d1a3ba..b4a7fb1 100644 --- a/variables.tf +++ b/variables.tf @@ -10,7 +10,7 @@ variable "create_role" { default = true } -variable "append_rule_name" { +variable "append_rule_postfix" { description = "Controls whether to append '-rule' to the name of the rule" type = bool default = true From 9ef6cbe4212db536e0935c85477aacc5d10ddcac Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 14 Jul 2022 17:06:53 +0300 Subject: [PATCH 3/8] fix --- main.tf | 4 ++-- variables.tf | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index ad74d17..8821e09 100644 --- a/main.tf +++ b/main.tf @@ -19,14 +19,14 @@ locals { for index, conn in var.connections : merge(conn, { "name" = index - "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_connection_postfix ? "${replace(index, "_", "-")}-rule" : index }) ]) eventbridge_api_destinations = flatten([ for index, dest in var.api_destinations : merge(dest, { "name" = index - "Name" = var.append_rule_postfix ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_destination_postfix ? "${replace(index, "_", "-")}-rule" : index }) ]) } diff --git a/variables.tf b/variables.tf index b4a7fb1..840bed4 100644 --- a/variables.tf +++ b/variables.tf @@ -16,6 +16,18 @@ variable "append_rule_postfix" { default = true } +variable "append_connection_postfix" { + description = "Controls whether to append '-rule' to the name of the connection" + type = bool + default = true +} + +variable "append_destination_postfix" { + description = "Controls whether to append '-rule' to the name of the destination" + type = bool + default = true +} + variable "create_bus" { description = "Controls whether EventBridge Bus resource should be created" type = bool From 5ef479af69819050d7c16b631dbeebb37e1a02d3 Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 14 Jul 2022 17:14:52 +0300 Subject: [PATCH 4/8] fix --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 8821e09..11ffd0f 100644 --- a/main.tf +++ b/main.tf @@ -19,14 +19,14 @@ locals { for index, conn in var.connections : merge(conn, { "name" = index - "Name" = var.append_connection_postfix ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_connection_postfix ? "${replace(index, "_", "-")}-connection" : index }) ]) eventbridge_api_destinations = flatten([ for index, dest in var.api_destinations : merge(dest, { "name" = index - "Name" = var.append_destination_postfix ? "${replace(index, "_", "-")}-rule" : index + "Name" = var.append_destination_postfix ? "${replace(index, "_", "-")}-destination" : index }) ]) } From fa37cdec0b2c3875e6b2198d57dfc1aeacbd18c2 Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 14 Jul 2022 17:18:10 +0300 Subject: [PATCH 5/8] fix --- variables.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/variables.tf b/variables.tf index 840bed4..4529eab 100644 --- a/variables.tf +++ b/variables.tf @@ -17,13 +17,13 @@ variable "append_rule_postfix" { } variable "append_connection_postfix" { - description = "Controls whether to append '-rule' to the name of the connection" + description = "Controls whether to append '-connection' to the name of the connection" type = bool default = true } variable "append_destination_postfix" { - description = "Controls whether to append '-rule' to the name of the destination" + description = "Controls whether to append '-destination' to the name of the destination" type = bool default = true } From 9becb8d7a491fb4758c9bc0182f4e4bf7a3156c5 Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 21 Jul 2022 17:57:14 +0300 Subject: [PATCH 6/8] Update main.tf --- examples/complete/main.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index ee6489d..ef740a5 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -34,6 +34,8 @@ module "eventbridge" { attach_cloudwatch_policy = true cloudwatch_target_arns = [aws_cloudwatch_log_group.this.arn] + + append_rule_postfix = false attach_ecs_policy = true ecs_target_arns = [aws_ecs_task_definition.hello_world.arn] From c79839f3882daa1799b975bc351b9b2f94db7c75 Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 28 Jul 2022 11:25:58 +0300 Subject: [PATCH 7/8] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 06e59fe..fbc8ed5 100644 --- a/README.md +++ b/README.md @@ -424,6 +424,9 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [api\_destinations](#input\_api\_destinations) | A map of objects with EventBridge Destination definitions. | `map(any)` | `{}` | no | +| [append\_connection\_postfix](#input\_append\_connection\_postfix) | Controls whether to append '-connection' to the name of the connection | `bool` | `true` | no | +| [append\_destination\_postfix](#input\_append\_destination\_postfix) | Controls whether to append '-destination' to the name of the destination | `bool` | `true` | no | +| [append\_rule\_postfix](#input\_append\_rule\_postfix) | Controls whether to append '-rule' to the name of the rule | `bool` | `true` | no | | [archives](#input\_archives) | A map of objects with the EventBridge Archive definitions. | `map(any)` | `{}` | no | | [attach\_api\_destination\_policy](#input\_attach\_api\_destination\_policy) | Controls whether the API Destination policy should be added to IAM role for EventBridge Target | `bool` | `false` | no | | [attach\_cloudwatch\_policy](#input\_attach\_cloudwatch\_policy) | Controls whether the Cloudwatch policy should be added to IAM role for EventBridge Target | `bool` | `false` | no | From 7e349a5c9333c9c2f9d93672f4f172b67ced621e Mon Sep 17 00:00:00 2001 From: "ahmad.salah" Date: Thu, 28 Jul 2022 11:41:32 +0300 Subject: [PATCH 8/8] Update main.tf --- examples/complete/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index ef740a5..488fc70 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -34,7 +34,7 @@ module "eventbridge" { attach_cloudwatch_policy = true cloudwatch_target_arns = [aws_cloudwatch_log_group.this.arn] - + append_rule_postfix = false attach_ecs_policy = true