Skip to content

Commit 4e1f4bd

Browse files
authored
Support cloudwatch oam modules (#11)
1 parent 379dc18 commit 4e1f4bd

File tree

24 files changed

+685
-5
lines changed

24 files changed

+685
-5
lines changed

.github/labeler.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
- modules/cloudwatch-log-group/**/*
44
":floppy_disk: cloudwatch-log-policy":
55
- modules/cloudwatch-log-policy/**/*
6+
":floppy_disk: cloudwatch-oam-link":
7+
- modules/cloudwatch-oam-link/**/*
8+
":floppy_disk: cloudwatch-oam-sink":
9+
- modules/cloudwatch-oam-sink/**/*

.github/labels.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@
4646
- color: "fbca04"
4747
description: "This issue or pull request is related to cloudwatch-log-policy module."
4848
name: ":floppy_disk: cloudwatch-log-policy"
49+
- color: "fbca04"
50+
description: "This issue or pull request is related to cloudwatch-oam-link module."
51+
name: ":floppy_disk: cloudwatch-oam-link"
52+
- color: "fbca04"
53+
description: "This issue or pull request is related to cloudwatch-oam-sink module."
54+
name: ":floppy_disk: cloudwatch-oam-sink"

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ Terraform Modules from [this package](https://github.com/tedilabs/terraform-aws-
1717
- Log Groups
1818
- Resource Policy
1919
- Metrics (Comming soon!)
20+
- OAM (Observability Access Manager)
21+
- Sink (Monitoring Account)
22+
- Link (Source Account)
23+
24+
25+
## Examples
26+
27+
### AWS CloudWatch
28+
29+
#### Logs
30+
31+
- [CloudWatch Log Group Full](./examples/cloudwatch-log-group-full)
32+
- [CloudWatch Log Policy for OpenSearch](./examples/cloudwatch-log-policy-es)
33+
- [CloudWatch Log Policy for Route53](./examples/cloudwatch-log-policy-route53)
34+
35+
#### OAM (Observability Access Manager)
36+
37+
- [CloudWatch OAM Cross Account Observability](./examples/cloudwatch-oam-cross-account-observability)
2038

2139

2240
## Self Promotion

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.2
1+
0.2.0

examples/cloudwatch-log-group-full/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ provider "aws" {
1010
module "log_group" {
1111
source = "../../modules/cloudwatch-log-group"
1212
# source = "tedilabs/observability/aws//modules/cloudwatch-log-group"
13-
# version = "~> 0.1.0"
13+
# version = "~> 0.2.0"
1414

1515
name = "/tedilabs/test"
1616

@@ -23,6 +23,6 @@ module "log_group" {
2323
]
2424

2525
tags = {
26-
"project" = "terraform-aws-secret-examples"
26+
"project" = "terraform-aws-observability-examples"
2727
}
2828
}

examples/cloudwatch-log-policy-es/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data "aws_caller_identity" "this" {}
1111
module "log_policy" {
1212
source = "../../modules/cloudwatch-log-policy"
1313
# source = "tedilabs/observability/aws//modules/cloudwatch-log-policy"
14-
# version = "~> 0.1.0"
14+
# version = "~> 0.2.0"
1515

1616
name = "es"
1717
service = "es.amazonaws.com"

examples/cloudwatch-log-policy-route53/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data "aws_caller_identity" "this" {}
1111
module "log_policy" {
1212
source = "../../modules/cloudwatch-log-policy"
1313
# source = "tedilabs/observability/aws//modules/cloudwatch-log-policy"
14-
# version = "~> 0.1.0"
14+
# version = "~> 0.2.0"
1515

1616
name = "route53"
1717
service = "route53.amazonaws.com"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
provider "aws" {
2+
alias = "monitoring"
3+
region = "us-east-1"
4+
}
5+
6+
provider "aws" {
7+
alias = "source"
8+
region = "us-east-1"
9+
}
10+
11+
data "aws_caller_identity" "monitoring" {
12+
provider = aws.monitoring
13+
}
14+
15+
data "aws_caller_identity" "source" {
16+
provider = aws.source
17+
}
18+
19+
20+
###################################################
21+
# CloudWatch OAM Sink
22+
###################################################
23+
24+
module "sink" {
25+
source = "../../modules/cloudwatch-oam-sink"
26+
# source = "tedilabs/observability/aws//modules/cloudwatch-oam-sink"
27+
# version = "~> 0.2.0"
28+
29+
providers = {
30+
aws = aws.monitoring
31+
}
32+
33+
name = "monitoring"
34+
35+
## Source Accounts
36+
telemetry_types = ["AWS::CloudWatch::Metric", "AWS::Logs::LogGroup", "AWS::XRay::Trace"]
37+
38+
allowed_source_accounts = [data.aws_caller_identity.source.account_id]
39+
allowed_source_organizations = []
40+
allowed_source_organization_paths = []
41+
42+
tags = {
43+
"project" = "terraform-aws-observability-examples"
44+
}
45+
}
46+
47+
48+
###################################################
49+
# CloudWatch OAM Link
50+
###################################################
51+
52+
module "link" {
53+
source = "../../modules/cloudwatch-oam-link"
54+
# source = "tedilabs/observability/aws//modules/cloudwatch-oam-link"
55+
# version = "~> 0.2.0"
56+
57+
providers = {
58+
aws = aws.source
59+
}
60+
61+
sink = module.sink.arn
62+
name = "source"
63+
64+
account_label = "$AccountName"
65+
telemetry_types = ["AWS::CloudWatch::Metric", "AWS::Logs::LogGroup", "AWS::XRay::Trace"]
66+
67+
tags = {
68+
"project" = "terraform-aws-observability-examples"
69+
}
70+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
output "sink" {
2+
value = module.sink
3+
}
4+
5+
output "link" {
6+
value = module.link
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = "~> 1.1"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)