Skip to content

Commit f7b8580

Browse files
committed
Add eventbridge example
1 parent 9211110 commit f7b8580

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

examples/eventbridge/main.tf

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
provider "aws" {
2+
region = "us-east-1"
3+
}
4+
5+
data "aws_caller_identity" "this" {}
6+
data "aws_region" "this" {}
7+
8+
locals {
9+
account_id = data.aws_caller_identity.this.account_id
10+
region = data.aws_region.this.name
11+
}
12+
13+
14+
###################################################
15+
# Event Bus on EventBridge
16+
###################################################
17+
18+
module "event_bus" {
19+
source = "../../modules/eventbridge-event-bus"
20+
# source = "tedilabs/messaging/aws//modules/eventbridge-event-bus"
21+
# version = "~> 0.2.0"
22+
23+
name = "aws"
24+
policy = jsonencode(yamldecode(<<EOF
25+
Version: "2008-10-17"
26+
Statement:
27+
- Sid: "AllowAccountToPutEvents"
28+
Effect: "Allow"
29+
Principal:
30+
"AWS": "${local.account_id}"
31+
Action:
32+
- "events:PutEvents"
33+
Resource: "arn:aws:events:${local.region}:${local.account_id}:event-bus/aws"
34+
EOF
35+
))
36+
37+
archives = [
38+
{
39+
name = "test"
40+
description = "Test Archive"
41+
}
42+
]
43+
schema_discovery = {
44+
enabled = false
45+
}
46+
47+
tags = {
48+
"project" = "terraform-aws-messaging-examples"
49+
}
50+
}

examples/eventbridge/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "event_bus" {
2+
description = "The event bus on EventBridge."
3+
value = module.event_bus
4+
}

examples/eventbridge/versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)