From 828a17fe35a623076002fa9fdabd4c89194172fe Mon Sep 17 00:00:00 2001 From: badra001 Date: Wed, 26 Jan 2022 13:07:18 -0500 Subject: [PATCH] add tags --- cloudwatch.tf | 21 +++++++++++++++++---- version.tf | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cloudwatch.tf b/cloudwatch.tf index 33baf71..61b32a4 100644 --- a/cloudwatch.tf +++ b/cloudwatch.tf @@ -29,13 +29,26 @@ resource "aws_cloudwatch_event_rule" "ec2_rule" { name = local.name description = "Capture EC2 Events to hande dynamic Route53 registration" event_pattern = jsonencode(local.cloudwatch_event_pattern) + + tags = merge( + local.base_tags, + var.tags, + map("Name", local.name), + ) } resource "aws_cloudwatch_event_target" "ec2_target" { - count = var.create ? 1 : 0 - target_id = local.name - arn = var.create ? aws_lambda_function.lambda[0].arn : null - rule = var.create ? aws_cloudwatch_event_rule.ec2_rule[0].name : null + count = var.create ? 1 : 0 + target_id = local.name + arn = var.create ? aws_lambda_function.lambda[0].arn : null + rule = var.create ? aws_cloudwatch_event_rule.ec2_rule[0].name : null + propagate_tags = true + + tags = merge( + local.base_tags, + var.tags, + map("Name", local.name), + ) } resource "aws_lambda_permission" "allow_cloudwatch" { diff --git a/version.tf b/version.tf index 8c978d6..980343a 100644 --- a/version.tf +++ b/version.tf @@ -1,3 +1,3 @@ locals { - _module_version = "0.0.10" + _module_version = "0.0.11" }