Skip to content

Commit 37fa957

Browse files
author
sourabh
committed
adding test cases for Root Cause.
1 parent 3184270 commit 37fa957

File tree

8 files changed

+514
-11
lines changed

8 files changed

+514
-11
lines changed

aws/rootcause/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ This module is used to create the SumoLogic AWS RootCause sources. Features incl
2929
| Name | Description | Type | Default | Required |
3030
|------|-------------|------|---------|:--------:|
3131
| aws\_iam\_role\_arn | Provide an existing AWS IAM role ARN value to attach to Sumo Logic sources. If this is kept empty, a new IAM role will be created. | `string` | `""` | no |
32-
| collector\_details | Provide details for the Sumo Logic collector. If not provided, then defaults will be used. | <pre>object({<br> collector_name = string<br> description = string<br> fields = map(string)<br> })</pre> | <pre>{<br> "collector_name": "SumoLogic RootCause Collector <Random ID>",<br> "description": "This collector is created using Sumo Logic terraform AWS Cloudwatch metrics module to collect AWS cloudwatch metrics.",<br> "fields": {}<br>}</pre> | no |
32+
| collector\_details | Provide details for the Sumo Logic collector. If not provided, then defaults will be used. | <pre>object({<br> collector_name = string<br> description = string<br> fields = map(string)<br> })</pre> | <pre>{<br> "collector_name": "SumoLogic RootCause Collector <Random ID>",<br> "description": "This collector is created using Sumo Logic terraform AWS Root Cause module.",<br> "fields": {}<br>}</pre> | no |
3333
| create\_collector | Provide "true" if you would like to create the Sumo Logic Collector. | `bool` | n/a | yes |
3434
| create\_inventory\_source | Provide "true" if you would like to create the Sumo Logic AWS Inventory source. | `bool` | n/a | yes |
3535
| create\_xray\_source | Provide "true" if you would like to create the Sumo Logic AWS Xray source. | `bool` | n/a | yes |
36-
| inventory\_source\_details | Provide details for the Sumo Logic AWS Inventory source. If not provided, then defaults will be used. | <pre>object({<br> source_name = string<br> source_category = string<br> collector_id = string<br> description = string<br> limit_to_regions = list(string)<br> limit_to_namespaces = list(string)<br> paused = bool<br> scan_interval = number<br> sumo_account_id = number<br> fields = map(string)<br> iam_role_arn = string<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS inventory metadata.",<br> "fields": {},<br> "iam_role_arn": "",<br> "limit_to_namespaces": [],<br> "limit_to_regions": [],<br> "paused": false,<br> "scan_interval": 300000,<br> "source_category": "Labs/inventory",<br> "source_name": "Inventory Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
36+
| inventory\_source\_details | Provide details for the Sumo Logic AWS Inventory source. If not provided, then defaults will be used. | <pre>object({<br> source_name = string<br> source_category = string<br> collector_id = string<br> description = string<br> limit_to_regions = list(string)<br> limit_to_namespaces = list(string)<br> paused = bool<br> scan_interval = number<br> sumo_account_id = number<br> fields = map(string)<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS inventory metadata.",<br> "fields": {},<br> "limit_to_namespaces": [],<br> "limit_to_regions": [],<br> "paused": false,<br> "scan_interval": 300000,<br> "source_category": "Labs/inventory",<br> "source_name": "Inventory Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
3737
| sumologic\_organization\_id | Appears on the Account Overview page that displays information about your Sumo Logic organization. Used for IAM Role in Sumo Logic AWS Sources. | `string` | n/a | yes |
38-
| xray\_source\_details | Provide details for the Sumo Logic AWS XRAY source. If not provided, then defaults will be used. | <pre>object({<br> source_name = string<br> source_category = string<br> collector_id = string<br> description = string<br> limit_to_regions = list(string)<br> paused = bool<br> scan_interval = number<br> sumo_account_id = number<br> fields = map(string)<br> iam_role_arn = string<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS Xray metrics.",<br> "fields": {},<br> "iam_role_arn": "",<br> "limit_to_regions": [],<br> "paused": false,<br> "scan_interval": 300000,<br> "source_category": "Labs/xray",<br> "source_name": "Xray Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
38+
| xray\_source\_details | Provide details for the Sumo Logic AWS XRAY source. If not provided, then defaults will be used. | <pre>object({<br> source_name = string<br> source_category = string<br> collector_id = string<br> description = string<br> limit_to_regions = list(string)<br> paused = bool<br> scan_interval = number<br> sumo_account_id = number<br> fields = map(string)<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS Xray metrics.",<br> "fields": {},<br> "limit_to_regions": [],<br> "paused": false,<br> "scan_interval": 300000,<br> "source_category": "Labs/xray",<br> "source_name": "Xray Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
3939

4040
## Outputs
4141

aws/rootcause/rootcause.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ resource "sumologic_aws_inventory_source" "aws_inventory_source" {
5858

5959
authentication {
6060
type = "AWSRoleBasedAuthentication"
61-
role_arn = local.create_iam_role ? aws_iam_role.source_iam_role["source_iam_role"].arn : var.inventory_source_details.iam_role_arn
61+
role_arn = local.create_iam_role ? aws_iam_role.source_iam_role["source_iam_role"].arn : var.aws_iam_role_arn
6262
}
6363

6464
path {
@@ -69,7 +69,7 @@ resource "sumologic_aws_inventory_source" "aws_inventory_source" {
6969
}
7070

7171
resource "sumologic_aws_xray_source" "aws_xray_source" {
72-
for_each = toset(var.create_inventory_source ? ["aws_xray_source"] : [])
72+
for_each = toset(var.create_xray_source ? ["aws_xray_source"] : [])
7373
depends_on = [
7474
time_sleep.wait_3_minutes
7575
]
@@ -84,7 +84,7 @@ resource "sumologic_aws_xray_source" "aws_xray_source" {
8484

8585
authentication {
8686
type = "AWSRoleBasedAuthentication"
87-
role_arn = local.create_iam_role ? aws_iam_role.source_iam_role["source_iam_role"].arn : var.xray_source_details.iam_role_arn
87+
role_arn = local.create_iam_role ? aws_iam_role.source_iam_role["source_iam_role"].arn : var.aws_iam_role_arn
8888
}
8989

9090
path {

aws/rootcause/variables.tf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variable "collector_details" {
1212
description = "Provide details for the Sumo Logic collector. If not provided, then defaults will be used."
1313
default = {
1414
collector_name = "SumoLogic RootCause Collector <Random ID>"
15-
description = "This collector is created using Sumo Logic terraform AWS Cloudwatch metrics module to collect AWS cloudwatch metrics."
15+
description = "This collector is created using Sumo Logic terraform AWS Root Cause module."
1616
fields = {}
1717
}
1818
}
@@ -34,7 +34,6 @@ variable "inventory_source_details" {
3434
scan_interval = number
3535
sumo_account_id = number
3636
fields = map(string)
37-
iam_role_arn = string
3837
})
3938
description = "Provide details for the Sumo Logic AWS Inventory source. If not provided, then defaults will be used."
4039
default = {
@@ -48,7 +47,6 @@ variable "inventory_source_details" {
4847
paused = false
4948
sumo_account_id = 926226587429
5049
fields = {}
51-
iam_role_arn = ""
5250
}
5351
}
5452

@@ -68,7 +66,6 @@ variable "xray_source_details" {
6866
scan_interval = number
6967
sumo_account_id = number
7068
fields = map(string)
71-
iam_role_arn = string
7269
})
7370
description = "Provide details for the Sumo Logic AWS XRAY source. If not provided, then defaults will be used."
7471
default = {
@@ -81,7 +78,6 @@ variable "xray_source_details" {
8178
paused = false
8279
sumo_account_id = 926226587429
8380
fields = {}
84-
iam_role_arn = ""
8581
}
8682
}
8783

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"random_string": {
3+
"lower": true
4+
},
5+
"aws_iam_role": [
6+
{
7+
"source_iam_role": {
8+
"name": "SumoLogic-RootCause-Module-{RandomString}",
9+
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::{SumoAccountId}:root\"},\"Action\":\"sts:AssumeRole\",\"Condition\":{\"StringEquals\":{\"sts:ExternalId\":\"{Deployment}:{OrgId}\"}}}]}"
10+
}
11+
}
12+
],
13+
"sumologic_collector": {},
14+
"inventory_sumologic_source": [
15+
{
16+
"aws_inventory_source": {
17+
"category": "My/Test/cvategory",
18+
"content_type": "AwsInventory",
19+
"description": "This is description.",
20+
"path": [
21+
{
22+
"limit_to_regions": [
23+
"us-east-1"
24+
],
25+
"limit_to_namespaces": [
26+
"AWS/SNS",
27+
"AWS/SQS",
28+
"AWS/Events",
29+
"AWS/Lambda",
30+
"AWS/Logs",
31+
"AWS/S3",
32+
"AWS/Firehose"
33+
]
34+
}
35+
],
36+
"fields": {
37+
"TestCollector": "MyValue"
38+
},
39+
"paused": false,
40+
"scan_interval": 60000,
41+
"name": "My Inventory Source",
42+
"authentication": [
43+
{
44+
"role_arn": "arn:aws:iam::{AccountId}:role/SumoLogic-RootCause-Module-{RandomString}"
45+
}
46+
]
47+
}
48+
}
49+
],
50+
"xray_sumologic_source": {}
51+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"random_string": {
3+
"lower": true
4+
},
5+
"aws_iam_role": [
6+
{
7+
"source_iam_role": {
8+
"name": "SumoLogic-RootCause-Module-{RandomString}",
9+
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::{SumoAccountId}:root\"},\"Action\":\"sts:AssumeRole\",\"Condition\":{\"StringEquals\":{\"sts:ExternalId\":\"{Deployment}:{OrgId}\"}}}]}"
10+
}
11+
}
12+
],
13+
"sumologic_collector": [
14+
{
15+
"collector": {
16+
"description": "This collector is created using Sumo Logic terraform AWS Root Cause module.",
17+
"name": "SumoLogic RootCause Collector {RandomString}"
18+
}
19+
}
20+
],
21+
"inventory_sumologic_source": [
22+
{
23+
"aws_inventory_source": {
24+
"category": "Labs/inventory",
25+
"content_type": "AwsInventory",
26+
"description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS inventory metadata.",
27+
"path": [
28+
{
29+
"limit_to_regions": [],
30+
"limit_to_namespaces": []
31+
}
32+
],
33+
"paused": false,
34+
"scan_interval": 300000,
35+
"name": "Inventory Source",
36+
"authentication": [
37+
{
38+
"role_arn": "arn:aws:iam::{AccountId}:role/SumoLogic-RootCause-Module-{RandomString}"
39+
}
40+
]
41+
}
42+
}
43+
],
44+
"xray_sumologic_source": [
45+
{
46+
"aws_xray_source": {
47+
"category": "Labs/xray",
48+
"content_type": "AwsXRay",
49+
"description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS Xray metrics.",
50+
"path": [
51+
{
52+
"limit_to_regions": []
53+
}
54+
],
55+
"paused": false,
56+
"scan_interval": 300000,
57+
"name": "Xray Source",
58+
"authentication": [
59+
{
60+
"role_arn": "arn:aws:iam::{AccountId}:role/SumoLogic-RootCause-Module-{RandomString}"
61+
}
62+
]
63+
}
64+
}
65+
]
66+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"random_string": {
3+
"lower": true
4+
},
5+
"aws_iam_role": {},
6+
"sumologic_collector": {},
7+
"inventory_sumologic_source": [
8+
{
9+
"aws_inventory_source": {
10+
"category": "My/Test/cvategory",
11+
"content_type": "AwsInventory",
12+
"description": "This is description.",
13+
"path": [
14+
{
15+
"limit_to_regions": [
16+
"us-east-2"
17+
],
18+
"limit_to_namespaces": [
19+
"AWS/SNS",
20+
"AWS/SQS"
21+
]
22+
}
23+
],
24+
"fields": {
25+
"TestCollector": "MyValue"
26+
},
27+
"paused": false,
28+
"scan_interval": 60000,
29+
"name": "My Inventory Source Another",
30+
"authentication": [
31+
{
32+
"role_arn": "{ROLE_ARN}"
33+
}
34+
]
35+
}
36+
}
37+
],
38+
"xray_sumologic_source": [
39+
{
40+
"aws_xray_source": {
41+
"category": "My/Test/cvategory",
42+
"content_type": "AwsXRay",
43+
"description": "This is description.",
44+
"path": [
45+
{
46+
"limit_to_regions": [
47+
"ap-south-1"
48+
]
49+
}
50+
],
51+
"fields": {
52+
"TestCollector": "MyValue"
53+
},
54+
"paused": false,
55+
"scan_interval": 60000,
56+
"name": "My Xray Source Another",
57+
"authentication": [
58+
{
59+
"role_arn": "{ROLE_ARN}"
60+
}
61+
]
62+
}
63+
}
64+
]
65+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"random_string": {
3+
"lower": true
4+
},
5+
"aws_iam_role": [
6+
{
7+
"source_iam_role": {
8+
"name": "SumoLogic-RootCause-Module-{RandomString}",
9+
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::{SumoAccountId}:root\"},\"Action\":\"sts:AssumeRole\",\"Condition\":{\"StringEquals\":{\"sts:ExternalId\":\"{Deployment}:{OrgId}\"}}}]}"
10+
}
11+
}
12+
],
13+
"sumologic_collector": [
14+
{
15+
"collector": {
16+
"description": "This collector is created using Sumo Logic terraform AWS Root Cause module.",
17+
"name": "SumoLogic RootCause Collector {RandomString}"
18+
}
19+
}
20+
],
21+
"inventory_sumologic_source": {},
22+
"xray_sumologic_source": [
23+
{
24+
"aws_xray_source": {
25+
"category": "Labs/xray",
26+
"content_type": "AwsXRay",
27+
"description": "This source is created using Sumo Logic terraform AWS RootCause module to collect AWS Xray metrics.",
28+
"path": [
29+
{
30+
"limit_to_regions": []
31+
}
32+
],
33+
"paused": false,
34+
"scan_interval": 300000,
35+
"name": "Xray Source",
36+
"authentication": [
37+
{
38+
"role_arn": "arn:aws:iam::{AccountId}:role/SumoLogic-RootCause-Module-{RandomString}"
39+
}
40+
]
41+
}
42+
}
43+
]
44+
}

0 commit comments

Comments
 (0)