Sign in
Menu
Start free trial

Use this module

module "eventbridge" {
  source = "registry.compliance.tf/terraform-aws-modules/eventbridge/aws"

  bus_name = "my-bus"

  log_config = {
    include_detail = "FULL"
    level          = "INFO"
  }

  log_delivery = {
    cloudwatch_logs = {
      destination_arn = "arn:aws:logs:us-east-1:123456789012:log-group:my-log-group"
    }
    s3 = {
      destination_arn = "arn:aws:s3:::my-log-bucket"
    }
  }

  rules = {
    orders = {
      description   = "Capture all order data"
      event_pattern = jsonencode({ "source" : ["myapp.orders"] })
      enabled       = true
    }
  }

  targets = {
    orders = [
      {
        name            = "send-orders-to-sqs"
        arn             = aws_sqs_queue.queue.arn
        dead_letter_arn = aws_sqs_queue.dlq.arn
      },
      {
        name              = "send-orders-to-kinesis"
        arn               = aws_kinesis_stream.this.arn
        dead_letter_arn   = aws_sqs_queue.dlq.arn
        input_transformer = local.kinesis_input_transformer
      },
      {
        name = "log-orders-to-cloudwatch"
        arn  = aws_cloudwatch_log_group.this.arn
      }
    ]
  }

  tags = {
    Name = "my-bus"
  }
}

The example from the module's README, with this page's source.

Key inputs

Required inputs first, then the inputs the README example sets.

  • bus_namestring, default "default"

    A unique name for your EventBridge Bus

  • log_configobject({...}), default null

    The configuration block for the EventBridge bus log config settings

  • log_deliverymap({...}), default {}

    Map of the configuration block for the EventBridge bus log delivery settings (key is the type of log delivery: cloudwatch_logs, s3, firehose)

  • rulesany, default {}

    A map of objects with EventBridge Rule definitions.

  • targetsany, default {}

    A map of objects with EventBridge Target definitions.

  • tagsmap(string), default {}

    A map of tags to assign to resources.

All 83 inputs