Skip to content

Commit 40a7a2f

Browse files
authored
feat: Epose s3 log retention (#130)
1 parent 3ff7263 commit 40a7a2f

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

examples/organizational/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ $ terraform apply
183183
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
184184
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether the created cloudtrail will ingest multi-regional events. testing/economization purpose. | `bool` | `true` | no |
185185
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether the created cloudtrail should deliver encrypted events to s3 | `bool` | `true` | no |
186+
| <a name="input_cloudtrail_s3_bucket_expiration_days"></a> [cloudtrail\_s3\_bucket\_expiration\_days](#input\_cloudtrail\_s3\_bucket\_expiration\_days) | Number of days that the logs will persist in the bucket | `number` | `5` | no |
186187
| <a name="input_connector_ecs_task_role_name"></a> [connector\_ecs\_task\_role\_name](#input\_connector\_ecs\_task\_role\_name) | Name for the ecs task role. This is only required to resolve cyclic dependency with organizational approach | `string` | `"organizational-ECSTaskRole"` | no |
187188
| <a name="input_deploy_benchmark"></a> [deploy\_benchmark](#input\_deploy\_benchmark) | Whether to deploy or not the cloud benchmarking | `bool` | `true` | no |
188189
| <a name="input_deploy_benchmark_organizational"></a> [deploy\_benchmark\_organizational](#input\_deploy\_benchmark\_organizational) | true/false whether benchmark module should be deployed on organizational or single-account mode (1 role per org accounts if true, 1 role in default aws provider account if false)</li></ul> | `bool` | `true` | no |

examples/organizational/cloudtrail.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ module "cloudtrail" {
1616
sysdig_secure_for_cloud_member_account_id = var.sysdig_secure_for_cloud_member_account_id
1717
organizational_role_per_account = var.organizational_member_default_admin_role
1818
}
19-
is_multi_region_trail = var.cloudtrail_is_multi_region_trail
20-
cloudtrail_kms_enable = var.cloudtrail_kms_enable
19+
is_multi_region_trail = var.cloudtrail_is_multi_region_trail
20+
cloudtrail_kms_enable = var.cloudtrail_kms_enable
21+
s3_bucket_expiration_days = var.cloudtrail_s3_bucket_expiration_days
2122

2223
tags = var.tags
2324
}

examples/organizational/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ variable "cloudtrail_kms_enable" {
4040
description = "true/false whether the created cloudtrail should deliver encrypted events to s3"
4141
}
4242

43+
variable "cloudtrail_s3_bucket_expiration_days" {
44+
type = number
45+
default = 5
46+
description = "Number of days that the logs will persist in the bucket"
47+
}
4348

4449
variable "existing_cloudtrail_config" {
4550
type = object({

examples/single-account-ecs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ $ terraform apply
9999
| <a name="input_benchmark_regions"></a> [benchmark\_regions](#input\_benchmark\_regions) | List of regions in which to run the benchmark. If empty, the task will contain all aws regions by default. | `list(string)` | `[]` | no |
100100
| <a name="input_cloudtrail_is_multi_region_trail"></a> [cloudtrail\_is\_multi\_region\_trail](#input\_cloudtrail\_is\_multi\_region\_trail) | true/false whether cloudtrail will ingest multiregional events | `bool` | `true` | no |
101101
| <a name="input_cloudtrail_kms_enable"></a> [cloudtrail\_kms\_enable](#input\_cloudtrail\_kms\_enable) | true/false whether cloudtrail delivered events to S3 should persist encrypted | `bool` | `true` | no |
102+
| <a name="input_cloudtrail_s3_bucket_expiration_days"></a> [cloudtrail\_s3\_bucket\_expiration\_days](#input\_cloudtrail\_s3\_bucket\_expiration\_days) | Number of days that the logs will persist in the bucket | `number` | `5` | no |
102103
| <a name="input_cloudtrail_sns_arn"></a> [cloudtrail\_sns\_arn](#input\_cloudtrail\_sns\_arn) | ARN of a pre-existing cloudtrail\_sns. If defaulted, a new cloudtrail will be created. If specified, sysdig deployment account and region must match with the specified SNS | `string` | `"create"` | no |
103104
| <a name="input_deploy_benchmark"></a> [deploy\_benchmark](#input\_deploy\_benchmark) | Whether to deploy or not the cloud benchmarking | `bool` | `true` | no |
104105
| <a name="input_deploy_image_scanning_ecr"></a> [deploy\_image\_scanning\_ecr](#input\_deploy\_image\_scanning\_ecr) | true/false whether to deploy the image scanning on ECR pushed images | `bool` | `false` | no |

examples/single-account-ecs/cloudtrail.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ locals {
44
}
55

66
module "cloudtrail" {
7-
count = local.cloudtrail_deploy ? 1 : 0
8-
source = "../../modules/infrastructure/cloudtrail"
9-
name = var.name
10-
is_organizational = false
11-
is_multi_region_trail = var.cloudtrail_is_multi_region_trail
12-
cloudtrail_kms_enable = var.cloudtrail_kms_enable
7+
count = local.cloudtrail_deploy ? 1 : 0
8+
source = "../../modules/infrastructure/cloudtrail"
9+
name = var.name
10+
is_organizational = false
11+
is_multi_region_trail = var.cloudtrail_is_multi_region_trail
12+
cloudtrail_kms_enable = var.cloudtrail_kms_enable
13+
s3_bucket_expiration_days = var.cloudtrail_s3_bucket_expiration_days
1314

1415
tags = var.tags
1516
}

examples/single-account-ecs/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ variable "cloudtrail_kms_enable" {
2626
description = "true/false whether cloudtrail delivered events to S3 should persist encrypted"
2727
}
2828

29-
29+
variable "cloudtrail_s3_bucket_expiration_days" {
30+
type = number
31+
default = 5
32+
description = "Number of days that the logs will persist in the bucket"
33+
}
3034
#
3135
# ecs, security group, vpc
3236
#

0 commit comments

Comments
 (0)