https://github.com/senora-dev/terraform-aws-eventbridge-rule
This Terraform module creates an AWS EventBridge (CloudWatch Events) rule and its associated targets.
https://github.com/senora-dev/terraform-aws-eventbridge-rule
Last synced: 5 months ago
JSON representation
This Terraform module creates an AWS EventBridge (CloudWatch Events) rule and its associated targets.
- Host: GitHub
- URL: https://github.com/senora-dev/terraform-aws-eventbridge-rule
- Owner: Senora-dev
- Created: 2025-06-12T06:16:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-25T14:47:45.000Z (12 months ago)
- Last Synced: 2025-06-25T15:38:05.174Z (12 months ago)
- Language: HCL
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS EventBridge Rule Terraform Module
This Terraform module creates an AWS EventBridge (CloudWatch Events) rule and its associated targets.
## Features
- Create EventBridge rules with schedule expressions or event patterns
- Support for multiple target types:
- Lambda functions
- SQS queues
- SNS topics
- ECS tasks
- Batch jobs
- Kinesis streams
- HTTP endpoints
- Systems Manager Run Command
- Configurable retry policies and dead-letter queues
- Support for input transformers
- Tagging support
## Usage
```hcl
module "eventbridge_rule" {
source = "Senora-dev/eventbridge-rule/aws"
rule_name = "my-scheduled-rule"
schedule_expression = "rate(5 minutes)"
targets = {
lambda = {
arn = "arn:aws:lambda:region:account:function:my-function"
input = jsonencode({
key = "value"
})
}
sqs = {
arn = "arn:aws:sqs:region:account:my-queue"
sqs_target = {
message_group_id = "group1"
}
}
}
tags = {
Environment = "prod"
Project = "my-project"
}
}
```
## Examples
- [Basic Example](examples/basic/main.tf) - Creates a simple scheduled rule with a Lambda target
- [Complete Example](examples/complete/main.tf) - Creates a rule with multiple targets and advanced configurations
## Requirements
| Name | Version |
|------|---------|
| terraform | >= 1.0 |
| aws | >= 4.0 |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| create_rule | Whether to create the EventBridge rule | `bool` | `true` | no |
| create_target | Whether to create the EventBridge target | `bool` | `true` | no |
| rule_name | The name of the EventBridge rule | `string` | n/a | yes |
| rule_description | The description of the EventBridge rule | `string` | `null` | no |
| schedule_expression | The scheduling expression for the rule | `string` | `null` | no |
| event_pattern | The event pattern for the rule | `string` | `null` | no |
| rule_role_arn | The ARN of the IAM role associated with the rule | `string` | `null` | no |
| is_enabled | Whether the rule is enabled | `bool` | `true` | no |
| targets | Map of EventBridge targets | `map(object)` | `{}` | no |
| tags | A map of tags to add to all resources | `map(string)` | `{}` | no |
## Outputs
| Name | Description |
|------|-------------|
| rule_arn | The ARN of the EventBridge rule |
| rule_name | The name of the EventBridge rule |
| rule_id | The ID of the EventBridge rule |
| target_ids | The IDs of the EventBridge targets |
| target_arns | The ARNs of the EventBridge targets |
## License
MIT Licensed. See LICENSE for full details.
## Maintainers
This module is maintained by [Senora.dev](https://senora.dev).