File tree 2 files changed +25
-37
lines changed
2 files changed +25
-37
lines changed Original file line number Diff line number Diff line change
1
+ resource "aws_cloudwatch_event_rule" "this" {
2
+ name = " trigger-lambda-scheduler-${ var . name } "
3
+ description = " Trigger lambda scheduler"
4
+ schedule_expression = var. cloudwatch_schedule_expression
5
+ tags = var. tags
6
+ }
7
+
8
+ resource "aws_cloudwatch_event_target" "this" {
9
+ arn = aws_lambda_function. this . arn
10
+ rule = aws_cloudwatch_event_rule. this . name
11
+ }
12
+
13
+ resource "aws_lambda_permission" "this" {
14
+ statement_id = " AllowExecutionFromCloudWatch"
15
+ action = " lambda:InvokeFunction"
16
+ principal = " events.amazonaws.com"
17
+ function_name = aws_lambda_function. this . function_name
18
+ source_arn = aws_cloudwatch_event_rule. this . arn
19
+ }
20
+
21
+ resource "aws_cloudwatch_log_group" "this" {
22
+ name = " /aws/lambda/${ var . name } "
23
+ retention_in_days = 14
24
+ tags = var. tags
25
+ }
Original file line number Diff line number Diff line change @@ -37,40 +37,3 @@ resource "aws_lambda_function" "this" {
37
37
38
38
tags = var. tags
39
39
}
40
-
41
- # ###############################################
42
- #
43
- # CLOUDWATCH EVENT
44
- #
45
- # ###############################################
46
-
47
- resource "aws_cloudwatch_event_rule" "this" {
48
- name = " trigger-lambda-scheduler-${ var . name } "
49
- description = " Trigger lambda scheduler"
50
- schedule_expression = var. cloudwatch_schedule_expression
51
- tags = var. tags
52
- }
53
-
54
- resource "aws_cloudwatch_event_target" "this" {
55
- arn = aws_lambda_function. this . arn
56
- rule = aws_cloudwatch_event_rule. this . name
57
- }
58
-
59
- resource "aws_lambda_permission" "this" {
60
- statement_id = " AllowExecutionFromCloudWatch"
61
- action = " lambda:InvokeFunction"
62
- principal = " events.amazonaws.com"
63
- function_name = aws_lambda_function. this . function_name
64
- source_arn = aws_cloudwatch_event_rule. this . arn
65
- }
66
-
67
- # ###############################################
68
- #
69
- # CLOUDWATCH LOG
70
- #
71
- # ###############################################
72
- resource "aws_cloudwatch_log_group" "this" {
73
- name = " /aws/lambda/${ var . name } "
74
- retention_in_days = 14
75
- tags = var. tags
76
- }
You can’t perform that action at this time.
0 commit comments