Add group 1 audit logging encryption imports
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
resource "aws_s3_bucket" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = each.value
|
||||
force_destroy = false
|
||||
tags = lookup(var.bucket_tags, each.key, {})
|
||||
|
||||
lifecycle {
|
||||
prevent_destroy = true
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_versioning" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
|
||||
versioning_configuration {
|
||||
status = "Disabled"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_server_side_encryption_configuration" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
|
||||
rule {
|
||||
apply_server_side_encryption_by_default {
|
||||
sse_algorithm = "AES256"
|
||||
}
|
||||
|
||||
bucket_key_enabled = each.key != "cloudtrail"
|
||||
blocked_encryption_types = ["SSE-C"]
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_public_access_block" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
|
||||
block_public_acls = true
|
||||
block_public_policy = true
|
||||
ignore_public_acls = true
|
||||
restrict_public_buckets = true
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_ownership_controls" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
|
||||
rule {
|
||||
object_ownership = "BucketOwnerEnforced"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_policy" "this" {
|
||||
for_each = local.buckets
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
policy = local.bucket_policies[each.key]
|
||||
}
|
||||
|
||||
resource "aws_s3_bucket_lifecycle_configuration" "this" {
|
||||
for_each = local.lifecycle_rules
|
||||
|
||||
bucket = aws_s3_bucket.this[each.key].id
|
||||
transition_default_minimum_object_size = "all_storage_classes_128K"
|
||||
|
||||
rule {
|
||||
id = each.value.id
|
||||
status = "Enabled"
|
||||
|
||||
expiration {
|
||||
days = each.value.expiration_days
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user