/terraform-aws-eventbridge

Terraform module to create an Eventbridge resource on AWS.

Primary LanguageHCLApache License 2.0Apache-2.0

Terraform AWS eventbridge

Terraform module is used to create eventbridge resource on AWS for network connectivity..

Terraform Licence tfsec static-checks


Prerequisites

This module has a few dependencies:

IMPORTANT: Since the master branch used in source varies based on new modifications, we suggest that you use the release versions here.

event_bus_archive

Here is an example of how you can use this module in your inventory structure:

  module "eventbridge_archive" {

    create_bus      = true
    create_archives = true

    name        = "bus"
    environment = "test"
    label_order = ["name", "environment"]


    archives = {
    "launch-archive-existing-bus" = {
    description    = "launch-archive",
    retention_days = 1
    event_pattern = jsonencode(
    {
   "source" : ["aws.autoscaling"],
   "detail-type" : ["EC2 Instance Launch Successful"]
   }
    )
    }
    }

  }

event_rule_target

   module "eventbridge" {

      name        = "subnets"
      environment = "test"
      label_order = ["name", "environment"]

      rules = {
      orders = {
      description   = "Capture all order data"
      event_pattern = jsonencode({ "source" : ["myapp.orders"] })
      enabled       = true
      role_arn      = module.iam-role.arn
      }
      emails = {
      description   = "Capture all emails data"
      event_pattern = jsonencode({ "source" : ["myapp.emails"] })
      enabled       = true
      }
      }
      targets = {
      orders = [
      {
      name            = "send-orders-to-sqs-wth-dead-letter"
      arn             = aws_sqs_queue.queue.arn
      dead_letter_arn = aws_sqs_queue.dlq.arn
      },
      {
      name = "send-orders-to-sqs"
      arn  = aws_sqs_queue.queue.arn
      }
      ]
      emails = [
      {
      name            = "send-orders-to-kinesis"
      dead_letter_arn = aws_sqs_queue.dlq.arn
      arn             = aws_sqs_queue.dlq.arn

       }
        ]
      }
    }

Inputs

Name Description Type Default Required
archives A map of objects with the EventBridge Archive definitions. map(any) {} no
create Controls whether resources should be created bool true no
create_archives Controls whether EventBridge Archive resources should be created bool false no
create_bus Controls whether EventBridge Bus resource should be created bool true no
create_permissions Controls whether EventBridge Permission resources should be created bool true no
create_role Controls whether IAM role for Lambda Function should be created bool true no
create_rules Controls whether EventBridge Rule resources should be created bool true no
create_targets Controls whether EventBridge Target resources should be created bool true no
environment Environment (e.g. prod, dev, staging). string "" no
label_order Label order, e.g. name,application. list(any) [] no
name Name (e.g. app or cluster). string "" no
permissions A map of objects with EventBridge Permission definitions. map(any) {} no
repository Terraform current module repo string "https://github.com/clouddrove/terraform-aws-eventbridge" no
rules A map of objects with EventBridge Rule definitions. map(any) {} no
tags A map of tags to assign to resources. map(string) {} no
targets A map of objects with EventBridge Target definitions. any {} no

Outputs

Name Description
eventbridge_archive_arns The EventBridge Archive Arns created
eventbridge_bus_arn The EventBridge Bus Arn
eventbridge_rule_arns The EventBridge Rule ARNs created
eventbridge_rule_ids The EventBridge Rule IDs created
tags A mapping of tags to assign to the resource.

Feedback

If you come accross a bug or have any feedback, please log it in our issue tracker, or feel free to drop us an email at hello@clouddrove.com.

If you have found it worth your time, go ahead and give us a ★ on our GitHub!

About us

At CloudDrove, we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

We are The Cloud Experts!


We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.