Skip to content

Commit

Permalink
add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jan 26, 2022
1 parent 419aa95 commit 828a17f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
2 changes: 1 addition & 1 deletion version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "0.0.10"
_module_version = "0.0.11"
}

0 comments on commit 828a17f

Please sign in to comment.