afi-backup-monitor/terraform/events.tf
Adam Moussa 8f745ce898
feat(iac): add hcp terraform config for prod migration
Migrate afi-backup-monitor deploy path from SAM CD to HCP Terraform
parity config; freeze mgmt by removing push-to-main SAM deploy.
2026-08-05 12:01:05 -04:00

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
}