-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f71a2d
commit 9547143
Showing
11 changed files
with
506 additions
and
0 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
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,171 @@ | ||
// GENERATED FILE: DO NOT EDIT | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_0" { | ||
name = "${local.cloudwatch_event_0_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_0_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_0_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_0" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_0.name}" | ||
target_id = "${local.cloudwatch_event_0_name}" | ||
arn = "${local.lambda_0_arn}" | ||
|
||
count = "${local.cloudwatch_event_0_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_1" { | ||
name = "${local.cloudwatch_event_1_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_1_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_1_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_1" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_1.name}" | ||
target_id = "${local.cloudwatch_event_1_name}" | ||
arn = "${local.lambda_1_arn}" | ||
|
||
count = "${local.cloudwatch_event_1_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_2" { | ||
name = "${local.cloudwatch_event_2_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_2_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_2_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_2" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_2.name}" | ||
target_id = "${local.cloudwatch_event_2_name}" | ||
arn = "${local.lambda_2_arn}" | ||
|
||
count = "${local.cloudwatch_event_2_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_3" { | ||
name = "${local.cloudwatch_event_3_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_3_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_3_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_3" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_3.name}" | ||
target_id = "${local.cloudwatch_event_3_name}" | ||
arn = "${local.lambda_3_arn}" | ||
|
||
count = "${local.cloudwatch_event_3_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_4" { | ||
name = "${local.cloudwatch_event_4_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_4_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_4_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_4" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_4.name}" | ||
target_id = "${local.cloudwatch_event_4_name}" | ||
arn = "${local.lambda_4_arn}" | ||
|
||
count = "${local.cloudwatch_event_4_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_5" { | ||
name = "${local.cloudwatch_event_5_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_5_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_5_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_5" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_5.name}" | ||
target_id = "${local.cloudwatch_event_5_name}" | ||
arn = "${local.lambda_5_arn}" | ||
|
||
count = "${local.cloudwatch_event_5_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_6" { | ||
name = "${local.cloudwatch_event_6_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_6_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_6_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_6" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_6.name}" | ||
target_id = "${local.cloudwatch_event_6_name}" | ||
arn = "${local.lambda_6_arn}" | ||
|
||
count = "${local.cloudwatch_event_6_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_7" { | ||
name = "${local.cloudwatch_event_7_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_7_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_7_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_7" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_7.name}" | ||
target_id = "${local.cloudwatch_event_7_name}" | ||
arn = "${local.lambda_7_arn}" | ||
|
||
count = "${local.cloudwatch_event_7_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_8" { | ||
name = "${local.cloudwatch_event_8_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_8_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_8_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_8" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_8.name}" | ||
target_id = "${local.cloudwatch_event_8_name}" | ||
arn = "${local.lambda_8_arn}" | ||
|
||
count = "${local.cloudwatch_event_8_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_rule" "cloudwatch_event_9" { | ||
name = "${local.cloudwatch_event_9_name}" | ||
event_pattern = <<EOF | ||
${local.cloudwatch_event_9_pattern} | ||
EOF | ||
|
||
count = "${local.cloudwatch_event_9_count}" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "cloudwatch_event_9" { | ||
rule = "${aws_cloudwatch_event_rule.cloudwatch_event_9.name}" | ||
target_id = "${local.cloudwatch_event_9_name}" | ||
arn = "${local.lambda_9_arn}" | ||
|
||
count = "${local.cloudwatch_event_9_count}" | ||
} |
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,5 @@ | ||
# Cloudwatch Event Go | ||
|
||
## Introduction | ||
|
||
Creates a cloudwatch event with Go Lambda |
14 changes: 14 additions & 0 deletions
14
examples/cloudwatch-event-go/cloudwatch-event-pattern.json
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,14 @@ | ||
{ | ||
"source": [ | ||
"aws.ecs" | ||
], | ||
"detail-type": [ | ||
"ECS Task State Change", | ||
"ECS Container Instance State Change" | ||
], | ||
"detail": { | ||
"clusterArn": [ | ||
"arn:aws:ecs:us-west-2:ACCOUNT_ID:cluster/CLUSTER_NAME" | ||
] | ||
} | ||
} |
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,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/aws/aws-lambda-go/lambda" | ||
"github.com/davecgh/go-spew/spew" | ||
) | ||
|
||
// Response is the generic lambda response | ||
type Response struct { | ||
Message string `json:"message"` | ||
} | ||
|
||
// Handler is the main entrypoint for lambda | ||
func Handler(in interface{}) (Response, error) { | ||
fmt.Println("input:") | ||
spew.Dump(in) | ||
|
||
return Response{ | ||
Message: "hello world", | ||
}, nil | ||
} | ||
|
||
func main() { | ||
lambda.Start(Handler) | ||
} |
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,14 @@ | ||
provider "aws" { | ||
region = "us-west-2" | ||
} | ||
|
||
module "cloudwatch_event" { | ||
source = "../.." | ||
|
||
functions = [ | ||
{ | ||
file = "main.go" | ||
cloudwatch_event_pattern = "${file("cloudwatch-event-pattern.json")}" | ||
}, | ||
] | ||
} |
Oops, something went wrong.