Skip to content

Commit 2a54c51

Browse files
authored
Merge pull request #8 from SumoLogic/aws
making wait time as configurable as user can create IAM role outside …
2 parents 1111ffe + 56d636d commit 2a54c51

File tree

22 files changed

+121
-27
lines changed

22 files changed

+121
-27
lines changed

aws/cloudtrail/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This module is used to create AWS and Sumo Logic resource to collect CloudTrail
3737
| create\_trail | Provide "true" if you would like to create the AWS CloudTrail. If the bucket is created by the module, module by default creates the AWS cloudtrail. | `bool` | n/a | yes |
3838
| source\_details | Provide details for the Sumo Logic CloudTrail 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> bucket_details = object({<br> create_bucket = bool<br> bucket_name = string<br> path_expression = string<br> force_destroy_bucket = bool<br> })<br> paused = bool<br> scan_interval = string<br> sumo_account_id = number<br> cutoff_relative_time = string<br> fields = map(string)<br> iam_details = object({<br> create_iam_role = bool<br> iam_role_arn = string<br> })<br> sns_topic_details = object({<br> create_sns_topic = bool<br> sns_topic_arn = string<br> })<br> })</pre> | <pre>{<br> "bucket_details": {<br> "bucket_name": "cloudtrail-logs-random-id",<br> "create_bucket": true,<br> "force_destroy_bucket": true,<br> "path_expression": "AWSLogs/<ACCOUNT-ID>/CloudTrail/<REGION-NAME>/*"<br> },<br> "collector_id": "",<br> "cutoff_relative_time": "-1d",<br> "description": "This source is created using Sumo Logic terraform AWS cloudtrail module to collect AWS cloudtrail logs.",<br> "fields": {},<br> "iam_details": {<br> "create_iam_role": true,<br> "iam_role_arn": null<br> },<br> "paused": false,<br> "scan_interval": 300000,<br> "sns_topic_details": {<br> "create_sns_topic": true,<br> "sns_topic_arn": null<br> },<br> "source_category": "Labs/aws/cloudtrail",<br> "source_name": "CloudTrail Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
3939
| 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 |
40+
| wait\_for\_seconds | wait\_for\_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.<br> Default value is 180 seconds.<br> If the AWS IAM role is created outside the module, the value can be decreased to 1 second. | `number` | `180` | no |
4041

4142
## Outputs
4243

aws/cloudtrail/cloudtrail.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ resource "sumologic_collector" "collector" {
8888
timezone = "UTC"
8989
}
9090

91-
resource "time_sleep" "wait_3_minutes" {
92-
create_duration = "180s"
91+
resource "time_sleep" "wait_for_seconds" {
92+
create_duration = "${var.wait_for_seconds}s"
9393
}
9494

9595
resource "sumologic_cloudtrail_source" "source" {
9696
depends_on = [
97-
time_sleep.wait_3_minutes
97+
time_sleep.wait_for_seconds
9898
]
9999

100100
lifecycle {

aws/cloudtrail/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,14 @@ variable "cloudtrail_details" {
108108
is_organization_trail = false
109109
include_global_service_events = false
110110
}
111+
}
112+
113+
variable "wait_for_seconds" {
114+
type = number
115+
description = <<EOT
116+
wait_for_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.
117+
Default value is 180 seconds.
118+
If the AWS IAM role is created outside the module, the value can be decreased to 1 second.
119+
EOT
120+
default = 180
111121
}

aws/cloudwatchmetrics/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This module is used to create the SumoLogic AWS CloudWatch metrics source. Featu
3232
| create\_collector | Provide "true" if you would like to create the Sumo Logic Collector. | `bool` | n/a | yes |
3333
| source\_details | Provide details for the Sumo Logic Cloudwatch Metrics 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_details = object({<br> create_iam_role = bool<br> iam_role_arn = string<br> })<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS CloudWatch Metrics module to collect AWS Cloudwatch metrics.",<br> "fields": {},<br> "iam_details": {<br> "create_iam_role": true,<br> "iam_role_arn": null<br> },<br> "limit_to_namespaces": [],<br> "limit_to_regions": [],<br> "paused": false,<br> "scan_interval": 300000,<br> "source_category": "Labs/aws/cloudwatch/metrics",<br> "source_name": "CloudWatch Metrics Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
3434
| 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 |
35+
| wait\_for\_seconds | wait\_for\_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.<br> Default value is 180 seconds.<br> If the AWS IAM role is created outside the module, the value can be decreased to 1 second. | `number` | `180` | no |
3536

3637
## Outputs
3738

aws/cloudwatchmetrics/cloudwatchmetrics.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ resource "sumologic_collector" "collector" {
3838
timezone = "UTC"
3939
}
4040

41-
resource "time_sleep" "wait_3_minutes" {
42-
create_duration = "180s"
41+
resource "time_sleep" "wait_for_seconds" {
42+
create_duration = "${var.wait_for_seconds}s"
4343
}
4444

4545
resource "sumologic_cloudwatch_source" "cloudwatch_metrics_sources" {
4646
depends_on = [
47-
time_sleep.wait_3_minutes
47+
time_sleep.wait_for_seconds
4848
]
4949
category = var.source_details.source_category
5050
collector_id = var.create_collector ? sumologic_collector.collector["collector"].id : var.source_details.collector_id

aws/cloudwatchmetrics/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,14 @@ variable "sumologic_organization_id" {
6161
condition = can(regex("\\w+", var.sumologic_organization_id))
6262
error_message = "The organization ID must contain valid characters."
6363
}
64+
}
65+
66+
variable "wait_for_seconds" {
67+
type = number
68+
description = <<EOT
69+
wait_for_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.
70+
Default value is 180 seconds.
71+
If the AWS IAM role is created outside the module, the value can be decreased to 1 second.
72+
EOT
73+
default = 180
6474
}

aws/elb/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ This module is used to create AWS and Sumo Logic resource to collect ELB logs fr
3737
| create\_collector | Provide "true" if you would like to create the Sumo Logic Collector. | `bool` | n/a | yes |
3838
| source\_details | Provide details for the Sumo Logic ELB 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> bucket_details = object({<br> create_bucket = bool<br> bucket_name = string<br> path_expression = string<br> force_destroy_bucket = bool<br> })<br> paused = bool<br> scan_interval = string<br> sumo_account_id = number<br> cutoff_relative_time = string<br> fields = map(string)<br> iam_details = object({<br> create_iam_role = bool<br> iam_role_arn = string<br> })<br> sns_topic_details = object({<br> create_sns_topic = bool<br> sns_topic_arn = string<br> })<br> })</pre> | <pre>{<br> "bucket_details": {<br> "bucket_name": "elb-logs-random-id",<br> "create_bucket": true,<br> "force_destroy_bucket": true,<br> "path_expression": "*AWSLogs/<ACCOUNT-ID>/elasticloadbalancing/<REGION-NAME>/*"<br> },<br> "collector_id": "",<br> "cutoff_relative_time": "-1d",<br> "description": "This source is created using Sumo Logic terraform AWS elb module to collect AWS elb logs.",<br> "fields": {},<br> "iam_details": {<br> "create_iam_role": true,<br> "iam_role_arn": null<br> },<br> "paused": false,<br> "scan_interval": 300000,<br> "sns_topic_details": {<br> "create_sns_topic": true,<br> "sns_topic_arn": null<br> },<br> "source_category": "Labs/aws/elb",<br> "source_name": "Elb Source",<br> "sumo_account_id": 926226587429<br>}</pre> | no |
3939
| 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 |
40+
| wait\_for\_seconds | wait\_for\_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.<br> Default value is 180 seconds.<br> If the AWS IAM role is created outside the module, the value can be decreased to 1 second. | `number` | `180` | no |
4041

4142
## Outputs
4243

aws/elb/elb.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ resource "sumologic_collector" "collector" {
7979
timezone = "UTC"
8080
}
8181

82-
resource "time_sleep" "wait_3_minutes" {
83-
create_duration = "180s"
82+
resource "time_sleep" "wait_for_seconds" {
83+
create_duration = "${var.wait_for_seconds}s"
8484
}
8585

8686
resource "sumologic_elb_source" "source" {
8787
depends_on = [
88-
time_sleep.wait_3_minutes
88+
time_sleep.wait_for_seconds
8989
]
9090

9191
lifecycle {

aws/elb/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,14 @@ variable "auto_enable_access_logs_options" {
123123
filter = ""
124124
remove_on_delete_stack = true
125125
}
126+
}
127+
128+
variable "wait_for_seconds" {
129+
type = number
130+
description = <<EOT
131+
wait_for_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.
132+
Default value is 180 seconds.
133+
If the AWS IAM role is created outside the module, the value can be decreased to 1 second.
134+
EOT
135+
default = 180
126136
}

aws/kinesisfirehoseformetrics/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ This module is used to create the SumoLogic AWS Kinesis Firehose for Metrics sou
3535
| create\_collector | Provide "true" if you would like to create the Sumo Logic Collector. | `bool` | n/a | yes |
3636
| source\_details | Provide details for the Sumo Logic Kinesis Firehose for Metrics 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> sumo_account_id = number<br> limit_to_namespaces = list(string)<br> fields = map(string)<br> iam_details = object({<br> create_iam_role = bool<br> iam_role_arn = string<br> })<br> })</pre> | <pre>{<br> "collector_id": "",<br> "description": "This source is created using Sumo Logic terraform AWS Kinesis Firehose for metrics module to collect AWS Cloudwatch metrics.",<br> "fields": {},<br> "iam_details": {<br> "create_iam_role": true,<br> "iam_role_arn": null<br> },<br> "limit_to_namespaces": [],<br> "source_category": "Labs/aws/cloudwatch/metrics",<br> "source_name": "Kinesis Firehose for Metrics 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+
| wait\_for\_seconds | wait\_for\_seconds is used to delay sumo logic source creation. This helps persisting IAM role in AWS system.<br> Default value is 180 seconds.<br> If the AWS IAM role is created outside the module, the value can be decreased to 1 second. | `number` | `180` | no |
3839

3940
## Outputs
4041

0 commit comments

Comments
 (0)