Skip to content

Commit ea3a608

Browse files
Merge pull request #38 from SumoLogic/SUMO-254952
Sumo 254952: Sumo tf provider v3 updated | Mum deployment removed
2 parents f9ce3a1 + 784de8a commit ea3a608

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+311
-225
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The modules configure/create the following resources:
3030
}
3131
sumologic = {
3232
source = "sumologic/sumologic"
33-
version = ">= 2.31.3, < 3.0.0"
33+
version = ">= 2.31.3, < 4.0.0"
3434
}
3535
jira = {
3636
source = "fourplusone/jira"

aws/cloudtrail/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This module is used to create AWS and Sumo Logic resource to collect CloudTrail
1515
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
1616
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.16.2, < 6.0.0 |
1717
| <a name="requirement_random"></a> [random](#requirement\_random) | >=3.1.0 |
18-
| <a name="requirement_sumologic"></a> [sumologic](#requirement\_sumologic) | >= 2.31.3, < 3.0.0 |
18+
| <a name="requirement_sumologic"></a> [sumologic](#requirement\_sumologic) | >= 2.31.3, < 4.0.0 |
1919
| <a name="requirement_time"></a> [time](#requirement\_time) | >=0.7.1 |
2020

2121
## Providers
@@ -24,7 +24,7 @@ This module is used to create AWS and Sumo Logic resource to collect CloudTrail
2424
|------|---------|
2525
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.16.2, < 6.0.0 |
2626
| <a name="provider_random"></a> [random](#provider\_random) | >=3.1.0 |
27-
| <a name="provider_sumologic"></a> [sumologic](#provider\_sumologic) | >= 2.31.3, < 3.0.0 |
27+
| <a name="provider_sumologic"></a> [sumologic](#provider\_sumologic) | >= 2.31.3, < 4.0.0 |
2828
| <a name="provider_time"></a> [time](#provider\_time) | >=0.7.1 |
2929

3030
## Modules
@@ -38,6 +38,7 @@ No modules.
3838
| [aws_cloudtrail.cloudtrail](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail) | resource |
3939
| [aws_iam_policy.iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
4040
| [aws_iam_role.source_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
41+
| [aws_iam_role_policy_attachment.source-role-policy-attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
4142
| [aws_s3_bucket.s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
4243
| [aws_s3_bucket_notification.bucket_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) | resource |
4344
| [aws_s3_bucket_policy.s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
@@ -55,13 +56,13 @@ No modules.
5556

5657
| Name | Description | Type | Default | Required |
5758
|------|-------------|------|---------|:--------:|
58-
| <a name="input_cloudtrail_details"></a> [cloudtrail\_details](#input\_cloudtrail\_details) | Provide details for the AWS CloudTrail. If not provided, then defaults will be used. | <pre>object({<br> name = string<br> is_multi_region_trail = bool<br> is_organization_trail = bool<br> include_global_service_events = bool<br> })</pre> | <pre>{<br> "include_global_service_events": false,<br> "is_multi_region_trail": false,<br> "is_organization_trail": false,<br> "name": "SumoLogic-Terraform-CloudTrail-random-id"<br>}</pre> | no |
59-
| <a name="input_collector_details"></a> [collector\_details](#input\_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 CloudTrail Collector <Random ID>",<br> "description": "This collector is created using Sumo Logic terraform AWS cloudtrail module to collect AWS cloudtrail logs.",<br> "fields": {}<br>}</pre> | no |
59+
| <a name="input_cloudtrail_details"></a> [cloudtrail\_details](#input\_cloudtrail\_details) | Provide details for the AWS CloudTrail. If not provided, then defaults will be used. | <pre>object({<br/> name = string<br/> is_multi_region_trail = bool<br/> is_organization_trail = bool<br/> include_global_service_events = bool<br/> })</pre> | <pre>{<br/> "include_global_service_events": false,<br/> "is_multi_region_trail": false,<br/> "is_organization_trail": false,<br/> "name": "SumoLogic-Terraform-CloudTrail-random-id"<br/>}</pre> | no |
60+
| <a name="input_collector_details"></a> [collector\_details](#input\_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 CloudTrail Collector <Random ID>",<br/> "description": "This collector is created using Sumo Logic terraform AWS cloudtrail module to collect AWS cloudtrail logs.",<br/> "fields": {}<br/>}</pre> | no |
6061
| <a name="input_create_collector"></a> [create\_collector](#input\_create\_collector) | Provide "true" if you would like to create the Sumo Logic Collector. | `bool` | n/a | yes |
6162
| <a name="input_create_trail"></a> [create\_trail](#input\_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 |
62-
| <a name="input_source_details"></a> [source\_details](#input\_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 |
63+
| <a name="input_source_details"></a> [source\_details](#input\_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 |
6364
| <a name="input_sumologic_organization_id"></a> [sumologic\_organization\_id](#input\_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 |
64-
| <a name="input_wait_for_seconds"></a> [wait\_for\_seconds](#input\_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 |
65+
| <a name="input_wait_for_seconds"></a> [wait\_for\_seconds](#input\_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 |
6566

6667
## Outputs
6768

aws/cloudtrail/cloudtrail.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ resource "aws_iam_role" "source_iam_role" {
7575
ENVIRONMENT = data.sumologic_caller_identity.current.environment,
7676
SUMO_LOGIC_ORG_ID = var.sumologic_organization_id
7777
})
78-
79-
managed_policy_arns = [aws_iam_policy.iam_policy["iam_policy"].arn]
8078
}
8179

8280
resource "aws_iam_policy" "iam_policy" {
@@ -88,6 +86,12 @@ resource "aws_iam_policy" "iam_policy" {
8886
})
8987
}
9088

89+
resource "aws_iam_role_policy_attachment" "source-role-policy-attach" {
90+
for_each = toset(var.source_details.iam_details.create_iam_role ? ["source_iam_role"] : [])
91+
role = aws_iam_role.source_iam_role["source_iam_role"].name
92+
policy_arn = aws_iam_policy.iam_policy["iam_policy"].arn
93+
}
94+
9195
resource "sumologic_collector" "collector" {
9296
for_each = toset(var.create_collector ? ["collector"] : [])
9397
name = local.collector_name

aws/cloudtrail/examples/default/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
66
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.16.2, < 6.0.0 |
77
| <a name="requirement_random"></a> [random](#requirement\_random) | >=3.1.0 |
8-
| <a name="requirement_sumologic"></a> [sumologic](#requirement\_sumologic) | >= 2.31.3, < 3.0.0 |
8+
| <a name="requirement_sumologic"></a> [sumologic](#requirement\_sumologic) | >= 2.31.3, < 4.0.0 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.43.0 |
15-
| <a name="provider_random"></a> [random](#provider\_random) | 3.6.0 |
16-
| <a name="provider_sumologic"></a> [sumologic](#provider\_sumologic) | 2.28.3 |
14+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.16.2, < 6.0.0 |
15+
| <a name="provider_random"></a> [random](#provider\_random) | >=3.1.0 |
16+
| <a name="provider_sumologic"></a> [sumologic](#provider\_sumologic) | >= 2.31.3, < 4.0.0 |
1717

1818
## Modules
1919

@@ -36,8 +36,8 @@
3636
|------|-------------|------|---------|:--------:|
3737
| <a name="input_sumologic_access_id"></a> [sumologic\_access\_id](#input\_sumologic\_access\_id) | Sumo Logic Access ID. Visit https://help.sumologic.com/Manage/Security/Access-Keys#Create_an_access_key | `string` | n/a | yes |
3838
| <a name="input_sumologic_access_key"></a> [sumologic\_access\_key](#input\_sumologic\_access\_key) | Sumo Logic Access Key. Visit https://help.sumologic.com/Manage/Security/Access-Keys#Create_an_access_key | `string` | n/a | yes |
39-
| <a name="input_sumologic_environment"></a> [sumologic\_environment](#input\_sumologic\_environment) | Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2. For more information on Sumo Logic deployments visit https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security | `string` | n/a | yes |
40-
| <a name="input_sumologic_organization_id"></a> [sumologic\_organization\_id](#input\_sumologic\_organization\_id) | You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. Your org ID will be used to configure the IAM Role for Sumo Logic AWS Sources."<br> For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page | `string` | n/a | yes |
39+
| <a name="input_sumologic_environment"></a> [sumologic\_environment](#input\_sumologic\_environment) | Enter au, ca, de, eu, fed, jp, kr, us1 or us2. For more information on Sumo Logic deployments visit https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security | `string` | n/a | yes |
40+
| <a name="input_sumologic_organization_id"></a> [sumologic\_organization\_id](#input\_sumologic\_organization\_id) | You can find your org on the Preferences page in the Sumo Logic UI. For more information, see the Preferences Page topic. Your org ID will be used to configure the IAM Role for Sumo Logic AWS Sources."<br/> For more details, visit https://help.sumologic.com/01Start-Here/05Customize-Your-Sumo-Logic-Experience/Preferences-Page | `string` | n/a | yes |
4141

4242
## Outputs
4343

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
####### BELOW ARE REQUIRED PARAMETERS FOR TERRAFORM SCRIPT #######
2-
sumologic_environment = "<YOUR SUMO DEPLOYMENT>" # Please replace <YOUR SUMO DEPLOYMENT> (including brackets) with au, ca, de, eu, fed, in, jp, kr, us1 or us2.
2+
sumologic_environment = "<YOUR SUMO DEPLOYMENT>" # Please replace <YOUR SUMO DEPLOYMENT> (including brackets) with au, ca, de, eu, fed, jp, kr, us1 or us2.
33
sumologic_organization_id = "<YOUR SUMO ORG ID>" # Please replace <YOUR SUMO ORG ID> (including brackets) with your Sumo Logic Organization ID.
44
sumologic_access_id = "<YOUR SUMO ACCESS ID>" # Please replace <YOUR SUMO ACCESS ID> (including brackets) with your Sumo Logic Access ID.
5-
sumologic_access_key = "<YOUR SUMO ACCESS KEY>" # Please replace <YOUR SUMO ACCESS KEY> (including brackets) with your Sumo Logic Access KEY.
5+
sumologic_access_key = "<YOUR SUMO ACCESS KEY>" # Please replace <YOUR SUMO ACCESS KEY> (including brackets) with your Sumo Logic Access KEY.

aws/cloudtrail/examples/default/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
resource "random_string" "aws_random" {
32
length = 10
43
upper = false

aws/cloudtrail/examples/default/variables.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "sumologic_environment" {
22
type = string
3-
description = "Enter au, ca, de, eu, fed, in, jp, kr, us1 or us2. For more information on Sumo Logic deployments visit https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security"
3+
description = "Enter au, ca, de, eu, fed, jp, kr, us1 or us2. For more information on Sumo Logic deployments visit https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security"
44

55
validation {
66
condition = contains([
@@ -9,13 +9,12 @@ variable "sumologic_environment" {
99
"de",
1010
"eu",
1111
"fed",
12-
"in",
1312
"jp",
1413
"kr",
1514
"us1",
1615
"us2"
1716
], var.sumologic_environment)
18-
error_message = "The value must be one of au, ca, de, eu, fed, in, jp, kr, us1 or us2."
17+
error_message = "The value must be one of au, ca, de, eu, fed, jp, kr, us1 or us2."
1918
}
2019
}
2120

aws/cloudtrail/examples/default/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33

44
required_providers {
55
sumologic = {
6-
version = ">= 2.31.3, < 3.0.0"
6+
version = ">= 2.31.3, < 4.0.0"
77
source = "SumoLogic/sumologic"
88
}
99
aws = {

aws/cloudtrail/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
version = ">= 5.16.2, < 6.0.0"
88
}
99
sumologic = {
10-
version = ">= 2.31.3, < 3.0.0"
10+
version = ">= 2.31.3, < 4.0.0"
1111
source = "SumoLogic/sumologic"
1212
}
1313
time = {

0 commit comments

Comments
 (0)