- Added `filter {}` to resource `aws_s3_bucket_lifecycle_configuration`
block(s)
- Added `filter = []` to `module.s3_bucket_for_logs in
addons/logging-alb/main.tf`
- Added `filter = []` to `module.athena-s3-bucket in
addons/logging-alb/main.tf`
---
Addresses the following warnings.
```
No attribute specified when one (and only one) of [rule[0].filter,rule[0].prefix] is required
```
---
```
╷
│ Warning: Invalid Attribute Combination
│
│ with module.logging_alb.module.athena-s3-bucket[0].aws_s3_bucket_lifecycle_configuration.this[0],
│ on .terraform/modules/logging_alb.athena-s3-bucket/main.tf line 219, in resource "aws_s3_bucket_lifecycle_configuration" "this":
│ 219: resource "aws_s3_bucket_lifecycle_configuration" "this" {
│
│ 2 attributes specified when one (and only one) of [rule[0].expiration[0].date,rule[0].expiration[0].days,rule[0].expiration[0].expired_object_delete_marker] is required
```
61 lines
1.8 KiB
Terraform
61 lines
1.8 KiB
Terraform
// Customer keys are not supported in our Fleet Terraforms at the moment. We will evaluate the
|
|
// possibility of providing this capability in the future.
|
|
// No versioning on this bucket is by design.
|
|
// Bucket logging is not supported in our Fleet Terraforms at the moment. It can be enabled by the
|
|
// organizations deploying Fleet, and we will evaluate the possibility of providing this capability
|
|
// in the future.
|
|
|
|
resource "aws_s3_bucket" "main" { #tfsec:ignore:aws-s3-encryption-customer-key:exp:2022-07-01 #tfsec:ignore:aws-s3-enable-versioning #tfsec:ignore:aws-s3-enable-bucket-logging:exp:2022-06-15
|
|
bucket = var.osquery_carve_s3_bucket.name
|
|
}
|
|
|
|
resource "aws_s3_bucket_lifecycle_configuration" "main" {
|
|
bucket = aws_s3_bucket.main.bucket
|
|
rule {
|
|
status = "Enabled"
|
|
id = "expire"
|
|
expiration {
|
|
days = var.osquery_carve_s3_bucket.expires_days
|
|
}
|
|
filter {}
|
|
}
|
|
}
|
|
|
|
resource "aws_s3_bucket_server_side_encryption_configuration" "main" {
|
|
bucket = aws_s3_bucket.main.bucket
|
|
rule {
|
|
apply_server_side_encryption_by_default {
|
|
sse_algorithm = "aws:kms"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "aws_s3_bucket_public_access_block" "main" {
|
|
bucket = aws_s3_bucket.main.id
|
|
block_public_acls = true
|
|
block_public_policy = true
|
|
ignore_public_acls = true
|
|
restrict_public_buckets = true
|
|
}
|
|
|
|
data "aws_iam_policy_document" "main" {
|
|
statement {
|
|
actions = [
|
|
"s3:GetObject*",
|
|
"s3:PutObject*",
|
|
"s3:ListBucket*",
|
|
"s3:ListMultipartUploadParts*",
|
|
"s3:DeleteObject",
|
|
"s3:CreateMultipartUpload",
|
|
"s3:AbortMultipartUpload",
|
|
"s3:ListMultipartUploadParts",
|
|
"s3:GetBucketLocation"
|
|
]
|
|
resources = [aws_s3_bucket.main.arn, "${aws_s3_bucket.main.arn}/*"]
|
|
}
|
|
}
|
|
|
|
resource "aws_iam_policy" "main" {
|
|
policy = data.aws_iam_policy_document.main.json
|
|
}
|