DEV Community

leroykayanda
leroykayanda

Posted on

Terraform AWS module for an eventbridge rule

module "end_to_end_recon_time_eventbridge" {
  source               = "terraform-aws-modules/eventbridge/aws"
  create_bus           = false
  role_name            = "${var.env}-end-to-end-recon-time"
  attach_lambda_policy = true

  rules = {
    "${var.env}-end-to-end-recon-time" = {
      description         = "Trigger lambda that computes end to end reconciliation time"
      schedule_expression = "rate(10 minutes)"
    }
  }

  targets = {
    "${var.env}-end-to-end-recon-time" = [
      {
        name  = "end-to-end-recon-time"
        arn   = module.end_to_end_recon_time_lambda.arn
        input = jsonencode({ "job" : "cron-by-rate" })
      }
    ]
  }

  lambda_target_arns = [module.end_to_end_recon_time_lambda.arn]

  tags = {
    Name = "${var.env}-end-to-end-recon-time"
  }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)