Skip to content

Instantly share code, notes, and snippets.

@nhammad
Created March 31, 2022 17:24
Show Gist options
  • Save nhammad/1c7f9f68811ec5c53b8859f87a8926eb to your computer and use it in GitHub Desktop.
Save nhammad/1c7f9f68811ec5c53b8859f87a8926eb to your computer and use it in GitHub Desktop.
resource "aws_s3_bucket" "incoming" {
bucket = local.bucket_name
acl = "private"
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
kms_master_key_id = aws_kms_key.ingest.id
}
}
}
versioning {
enabled = true
}
}
resource "aws_kms_key" "incoming" {
description = "Encryption Key for the S3 Bucket"
deletion_window_in_days = 7
}
resource "aws_kms_alias" "ingest" {
name = "alias/${local.bucket_name}"
target_key_id = aws_kms_key.incoming.key_id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment