-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EPBR-6297 Creates a log group for ECS tasks
Each application creates an event rule that sends events to the ECS log group. This will enable the creation of a cloudwatch metric for stopped task that reads from the ECS log group
- Loading branch information
1 parent
1308ac1
commit 3307c91
Showing
5 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# AWS EventBridge rule | ||
resource "aws_cloudwatch_event_rule" "ecs_events" { | ||
name = "${var.prefix}-ecs-events" | ||
description = "${var.prefix} capture all ECS events " | ||
|
||
event_pattern = jsonencode({ | ||
"source" : ["aws.ecs"], | ||
"detail" : { | ||
"clusterArn" : [aws_ecs_cluster.this.arn] | ||
} | ||
}) | ||
} | ||
|
||
# AWS EventBridge target | ||
resource "aws_cloudwatch_event_target" "logs" { | ||
rule = aws_cloudwatch_event_rule.ecs_events.name | ||
target_id = "${var.prefix}-send-to-cloudwatch" | ||
arn = var.cloudwatch_ecs_events_arn | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,3 +172,7 @@ variable "exec_cmd_task_ram" { | |
default = 2048 | ||
} | ||
|
||
variable "cloudwatch_ecs_events_arn" { | ||
type = string | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters