mirror of
https://github.com/Sea-Haven-Industries/afi-backup-monitor.git
synced 2026-10-06 22:52:09 +00:00
Migrate afi-backup-monitor deploy path from SAM CD to HCP Terraform parity config; freeze mgmt by removing push-to-main SAM deploy.
41 lines
1.5 KiB
HCL
41 lines
1.5 KiB
HCL
resource "aws_cloudwatch_event_rule" "auto_protect" {
|
|
name = "afi-auto-protect-weekly"
|
|
description = "Weekly check for unprotected users"
|
|
schedule_expression = var.auto_protect_schedule
|
|
state = "ENABLED"
|
|
}
|
|
|
|
resource "aws_cloudwatch_event_target" "auto_protect" {
|
|
rule = aws_cloudwatch_event_rule.auto_protect.name
|
|
target_id = "afi-auto-protect"
|
|
arn = aws_lambda_function.auto_protect.arn
|
|
}
|
|
|
|
resource "aws_lambda_permission" "auto_protect_events" {
|
|
statement_id = "AllowExecutionFromEventBridge"
|
|
action = "lambda:InvokeFunction"
|
|
function_name = aws_lambda_function.auto_protect.function_name
|
|
principal = "events.amazonaws.com"
|
|
source_arn = aws_cloudwatch_event_rule.auto_protect.arn
|
|
}
|
|
|
|
resource "aws_cloudwatch_event_rule" "health_digest" {
|
|
name = "afi-health-digest-weekly"
|
|
description = "Weekly backup health digest to Slack"
|
|
schedule_expression = var.health_digest_schedule
|
|
state = "ENABLED"
|
|
}
|
|
|
|
resource "aws_cloudwatch_event_target" "health_digest" {
|
|
rule = aws_cloudwatch_event_rule.health_digest.name
|
|
target_id = "afi-health-digest"
|
|
arn = aws_lambda_function.health_digest.arn
|
|
}
|
|
|
|
resource "aws_lambda_permission" "health_digest_events" {
|
|
statement_id = "AllowExecutionFromEventBridge"
|
|
action = "lambda:InvokeFunction"
|
|
function_name = aws_lambda_function.health_digest.function_name
|
|
principal = "events.amazonaws.com"
|
|
source_arn = aws_cloudwatch_event_rule.health_digest.arn
|
|
}
|