Skip to content

Commit 8a62028

Browse files
authored
Merge pull request #35 from SumoLogic/awso-v2.11
Awso v2.11
2 parents e52b60d + 739ec37 commit 8a62028

File tree

14 files changed

+113
-37
lines changed

14 files changed

+113
-37
lines changed

aws/cloudwatchlogsforwarder/README.md

Lines changed: 13 additions & 13 deletions
Large diffs are not rendered by default.

aws/cloudwatchlogsforwarder/cloudwatchlogsforwarder.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ resource "aws_serverlessapplicationrepository_cloudformation_stack" "auto_enable
196196
DestinationArnType = "Lambda"
197197
DestinationArnValue = aws_lambda_function.logs_lambda_function.arn
198198
LogGroupPattern = var.auto_enable_logs_subscription_options.filter
199+
LogGroupTags = var.auto_enable_logs_subscription_options.tags_filter
199200
UseExistingLogs = local.auto_enable_existing
200201
}
201202
}

aws/cloudwatchlogsforwarder/examples/default/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ module "cloudwatch_logs_lambda_log_forwarder_module" {
2121
}
2222

2323
auto_enable_logs_subscription = "Both"
24-
app_semantic_version = "1.0.11"
24+
app_semantic_version = "1.0.14"
2525
auto_enable_logs_subscription_options = {
2626
filter = "lambda|rds"
27+
tags_filter = ""
2728
}
2829
}
2930

aws/cloudwatchlogsforwarder/variables.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ variable "source_details" {
7878
variable "app_semantic_version" {
7979
type = string
8080
description = "Provide the latest version of Serverless Application Repository 'sumologic-loggroup-connector'."
81-
default = "1.0.11"
81+
default = "1.0.14"
8282
}
8383

8484
variable "auto_enable_logs_subscription" {
@@ -103,14 +103,17 @@ variable "auto_enable_logs_subscription" {
103103
variable "auto_enable_logs_subscription_options" {
104104
type = object({
105105
filter = string
106+
tags_filter = string
106107
})
107108

108109
description = <<EOT
109-
filter - Enter regex for matching logGroups. Regex will check for the name. Visit https://help.sumologic.com/03Send-Data/Collect-from-Other-Data-Sources/Auto-Subscribe_AWS_Log_Groups_to_a_Lambda_Function#Configuring_parameters
110+
filter - Enter regex for matching logGroups. Regex will check for the name.
111+
tags_filter - Enter comma separated key value pairs for filtering logGroups using tags. Ex KeyName1=string,KeyName2=string. This is optional leave it blank if tag based filtering is not needed.
112+
Visit https://help.sumologic.com/docs/send-data/collect-from-other-data-sources/autosubscribe-arn-destination/#configuringparameters
110113
EOT
111114

112115
default = {
113116
filter = "lambda"
117+
tags_filter = ""
114118
}
115119
}
116-

aws/cloudwatchmetrics/cloudwatchmetrics.tf

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ resource "aws_iam_role" "source_iam_role" {
1919
ENVIRONMENT = data.sumologic_caller_identity.current.environment,
2020
SUMO_LOGIC_ORG_ID = var.sumologic_organization_id
2121
})
22-
23-
managed_policy_arns = [aws_iam_policy.iam_policy["iam_policy"].arn]
2422
}
2523

2624
resource "aws_iam_policy" "iam_policy" {
@@ -30,6 +28,14 @@ resource "aws_iam_policy" "iam_policy" {
3028
policy = templatefile("${path.module}/templates/sumologic_source_policy.tmpl", {})
3129
}
3230

31+
resource "aws_iam_role_policy_attachment" "policy_attachment" {
32+
depends_on = [aws_iam_policy.iam_policy]
33+
for_each = toset(var.source_details.iam_details.create_iam_role ? ["source_iam_role"] : [])
34+
35+
role = aws_iam_role.source_iam_role[each.key].name
36+
policy_arn = aws_iam_policy.iam_policy["iam_policy"].arn
37+
}
38+
3339
resource "sumologic_collector" "collector" {
3440
for_each = toset(var.create_collector ? ["collector"] : [])
3541
name = local.collector_name
@@ -64,6 +70,14 @@ resource "sumologic_cloudwatch_source" "cloudwatch_metrics_sources" {
6470
type = "CloudWatchPath"
6571
limit_to_regions = var.source_details.limit_to_regions
6672
limit_to_namespaces = var.source_details.limit_to_namespaces
73+
74+
dynamic "tag_filters" {
75+
for_each = var.source_details.tag_filters
76+
content {
77+
type = tag_filters.value.type
78+
namespace = tag_filters.value.namespace
79+
tags = tag_filters.value.tags
80+
}
81+
}
6782
}
6883
}
69-

aws/cloudwatchmetrics/examples/default/main.tf

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ module "cloudwatch_metrics" {
1212
"create_iam_role": true,
1313
"iam_role_arn": null
1414
},
15-
"limit_to_namespaces": ["aws/ec2"],
15+
"limit_to_namespaces": ["AWS/EC2", "AWS/ApiGateway", "AWS/ApplicationELB"],
16+
"tag_filters": [{
17+
"type" = "TagFilters"
18+
"namespace" = "AWS/EC2"
19+
"tags" = ["env=prod;dev"]
20+
},{
21+
"type" = "TagFilters"
22+
"namespace" = "AWS/ApiGateway"
23+
"tags" = ["env=prod;dev"]
24+
},{
25+
"type" = "TagFilters"
26+
"namespace" = "AWS/ApplicationELB"
27+
"tags" = ["env=dev"]
28+
}],
1629
"limit_to_regions": ["eu-central-1"],
1730
"paused": false,
1831
"scan_interval": 300000,

aws/cloudwatchmetrics/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ variable "source_details" {
2525
description = string
2626
limit_to_regions = list(string)
2727
limit_to_namespaces = list(string)
28+
tag_filters = list(object({
29+
type = string
30+
namespace = string
31+
tags = list(string)
32+
}))
2833
paused = bool
2934
scan_interval = number
3035
sumo_account_id = number
@@ -42,6 +47,7 @@ variable "source_details" {
4247
collector_id = ""
4348
limit_to_regions = ["us-east-1"]
4449
limit_to_namespaces = ["AWS/ApplicationELB","AWS/ApiGateway","AWS/DynamoDB","AWS/Lambda","AWS/RDS","AWS/ECS","AWS/ElastiCache","AWS/ELB","AWS/NetworkELB","AWS/SQS","AWS/SNS"]
50+
tag_filters = []
4551
scan_interval = 300000
4652
paused = false
4753
sumo_account_id = 926226587429

aws/kinesisfirehoseforlogs/README.md

Lines changed: 10 additions & 10 deletions
Large diffs are not rendered by default.

aws/kinesisfirehoseforlogs/examples/default/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ module "kinesis_firehose_for_logs_module" {
2424
}
2525

2626
auto_enable_logs_subscription = "Both"
27-
app_semantic_version = "1.0.11"
27+
app_semantic_version = "1.0.14"
2828
auto_enable_logs_subscription_options = {
2929
filter = "lambda|rds"
30+
tags_filter = ""
3031
}
3132
}

aws/kinesisfirehoseforlogs/kinesisfirehoseforlogs.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ resource "aws_serverlessapplicationrepository_cloudformation_stack" "auto_enable
178178
DestinationArnType = "Kinesis"
179179
DestinationArnValue = aws_kinesis_firehose_delivery_stream.logs_delivery_stream.arn
180180
LogGroupPattern = var.auto_enable_logs_subscription_options.filter
181+
LogGroupTags = var.auto_enable_logs_subscription_options.tags_filter
181182
UseExistingLogs = local.auto_enable_existing
182183
RoleArn = aws_iam_role.logs_role.arn
183184
}

0 commit comments

Comments
 (0)