Skip to content

Commit 9e7c84f

Browse files
authored
add variable for shared resources (#4)
1 parent c93802d commit 9e7c84f

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- BEGIN_TF_DOCS -->
21
# Terraform Aws Cloudwatch Oam Module
32
Terraform module to create an AWS CloudWatch OAM
43

@@ -42,12 +41,14 @@ module "sink" {
4241
|------|-------------|------|---------|:--------:|
4342
| <a name="input_name"></a> [name](#input\_name) | The Name of the Cloudwatch OAM sink. | `string` | n/a | yes |
4443
| <a name="input_organization_id"></a> [organization\_id](#input\_organization\_id) | Your AWS Organization ID, used in the AWS Cloudwatch Sink Access policy to accept incoming Cloudwatch metrics and logs, and XRay traces. | `string` | n/a | yes |
44+
| <a name="input_shared_resources"></a> [shared\_resources](#input\_shared\_resources) | List of data resources to be shared | `list(string)` | <pre>[<br/> "AWS::Logs::LogGroup",<br/> "AWS::CloudWatch::Metric",<br/> "AWS::XRay::Trace"<br/>]</pre> | no |
4545
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resource. If configured with a provider default\_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level. | `map(string)` | `{}` | no |
4646

4747
## Outputs
4848

4949
| Name | Description |
5050
|------|-------------|
51+
| <a name="output_shared_resources"></a> [shared\_resources](#output\_shared\_resources) | List of data resources to be shared |
5152
| <a name="output_sink"></a> [sink](#output\_sink) | The Cloudwatch OAM Sink |
5253
| <a name="output_stackset_template"></a> [stackset\_template](#output\_stackset\_template) | The AWS Cloudformation Stackset template to use for creating AWS Cloudwatch OAM links. |
5354

@@ -59,5 +60,4 @@ Checkout our other :point\_right: [terraform modules](https://registry.terraform
5960

6061
## Copyright
6162

62-
Copyright © 2017-2024 [Blackbird Cloud](https://blackbird.cloud)
63-
<!-- END_TF_DOCS -->
63+
Copyright © 2017-2025 [Blackbird Cloud](https://blackbird.cloud)

main.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ resource "aws_oam_sink_policy" "default" {
2020
Principal = "*"
2121
Condition = {
2222
"ForAllValues:StringEquals" = {
23-
"oam:ResourceTypes" = [
24-
"AWS::Logs::LogGroup",
25-
"AWS::CloudWatch::Metric",
26-
"AWS::XRay::Trace"
27-
]
23+
"oam:ResourceTypes" = var.shared_resources
2824
}
2925
"ForAnyValue:StringEquals" : {
3026
"aws:PrincipalOrgID" : "${var.organization_id}"

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ output "sink" {
33
description = "The Cloudwatch OAM Sink"
44
}
55

6+
output "shared_resources" {
7+
value = var.shared_resources
8+
description = "List of data resources to be shared"
9+
}
10+
611
output "stackset_template" {
712
value = templatefile("${path.module}/stackset.tmpl", {
813
account_id = data.aws_caller_identity.default.account_id

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,13 @@ variable "tags" {
1313
description = "A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level."
1414
default = {}
1515
}
16+
17+
variable "shared_resources" {
18+
type = list(string)
19+
description = "List of data resources to be shared"
20+
default = [
21+
"AWS::Logs::LogGroup",
22+
"AWS::CloudWatch::Metric",
23+
"AWS::XRay::Trace"
24+
]
25+
}

0 commit comments

Comments
 (0)