diff --git a/bbb.tf b/bbb.tf new file mode 100644 index 000000000..15c57b308 --- /dev/null +++ b/bbb.tf @@ -0,0 +1,58 @@ +resource "aws_s3_bucket" "example" { + bucket = "my-tf-test-bucket" + acl = "private" + + tags = { + Name = "My Test Bucket" + Environment = "Dev" + } + + versioning { + enabled = false + mfa_delete = false + } +} + + +# Server Side Encryption +resource "aws_s3_bucket_server_side_encryption_configuration" "sse_example" { + bucket = aws_s3_bucket.example.bucket + + rule { + apply_server_side_encryption_by_default { + kms_master_key_id = aws_kms_key.testkey.arn + sse_algorithm = "aws:kms" + } + } +} + +resource "aws_kms_key" "testkey" { + description = "This is a test key that is used to encrypt bucket objects" + deletion_window_in_days = 10 + + tags = { + Name = "my_kms_key" + TestTag = "Value" + } + + policy = <