generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
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
478a144
commit 0c280db
Showing
3 changed files
with
142 additions
and
16 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,40 @@ | ||
resource "aws_cloudwatch_event_rule" "snapshotDBFunctionmon_sun" { | ||
name = "laa-createSnapshotRule-LWN8E1LNHFJR" | ||
description = "Fires every five minutes" | ||
schedule_expression = "cron(38 09 ? * MON-SUN *)" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "snapshotDBFunctioncheck_mon_sun" { | ||
rule = aws_cloudwatch_event_rule.snapshotDBFunctionmon_sun.name | ||
arn = aws_lambda_function.snapshotDBFunction.arn | ||
input =jsonencode({"appname": "apex Database Server"}) | ||
} | ||
|
||
resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_sun" { | ||
statement_id = "AllowExecutionFromCloudWatch" | ||
action = "lambda:InvokeFunction" | ||
function_name = aws_lambda_function.snapshotDBFunction.function_name | ||
principal = "events.amazonaws.com" | ||
source_arn = aws_cloudwatch_event_rule.snapshotDBFunctionmon_sun.arn | ||
} | ||
|
||
|
||
resource "aws_cloudwatch_event_rule" "deletesnapshotFunction_mon_fri" { | ||
name = "laa-deletesnapshotRule-LWN8E1LNHFJR" | ||
description = "Fires every five minutes" | ||
schedule_expression = "cron(38 09 ? * MON-SUN *)" | ||
} | ||
|
||
resource "aws_cloudwatch_event_target" "deletesnapshotFunctioncheck_mon_fri" { | ||
rule = aws_cloudwatch_event_rule.deletesnapshotFunction_mon_fri.name | ||
arn = aws_lambda_function.deletesnapshotFunction.arn | ||
input =jsonencode({"appname": "apex Database Server"}) | ||
} | ||
|
||
resource "aws_lambda_permission" "allow_cloudwatch_to_call_check_mon_fri" { | ||
statement_id = "AllowExecutionFromCloudWatch" | ||
action = "lambda:InvokeFunction" | ||
function_name = aws_lambda_function.deletesnapshotFunction.function_name | ||
principal = "events.amazonaws.com" | ||
source_arn = aws_cloudwatch_event_rule.deletesnapshotFunction_mon_fri.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
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,3 @@ | ||
output "lambdabucketname" { | ||
value = aws_s3_bucket.laa-lambda-backup.bucket | ||
} |