Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eventbridge-cloudwatch-terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ Important: this application uses various AWS services and there are costs associ

## How it works

The AWS SAM template deploys the resources and the IAM permissions required to run the application.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Removed an incorrect reference to "AWS SAM template" and "IAM permissions" since this is a Terraform pattern and no IAM resources are defined.


The EventBridge rule specified in `main.tf` filters the events based upon the criteria in the `aws_cloudwatch_event_rule` block. When matching events are sent to EventBridge that trigger the rule, they are delivered as a JSON event payload to CloudWatch Logs.

## Testing
Expand Down
6 changes: 3 additions & 3 deletions eventbridge-cloudwatch-terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.27"
version = "~> 6.0"
}
}

Expand Down Expand Up @@ -41,7 +41,7 @@ resource "aws_cloudwatch_log_resource_policy" "MyCloudWatchLogPolicy" {
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "${aws_cloudwatch_log_group.MyLogGroup.arn}",
"Resource": "${aws_cloudwatch_log_group.MyLogGroup.arn}:*",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Condition": {
"ArnEquals": {
"aws:SourceArn": "${aws_cloudwatch_event_rule.MyEventRule.arn}"
Expand Down Expand Up @@ -73,4 +73,4 @@ resource "aws_cloudwatch_event_target" "MyRuleTarget" {
output "CW-Logs-Stream-Name" {
value = aws_cloudwatch_log_group.MyLogGroup.id
description = "The CloudWatch Log Group Name"
}
}