s3.tf 918 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. Configuration of S3 bucket for certs and replay
  3. storage. Uses server side encryption to secure
  4. session replays and SSL certificates.
  5. */
  6. // S3 bucket for cluster storage
  7. resource "aws_s3_bucket" "storage" {
  8. bucket = "${var.instance_name}-${var.environment}"
  9. acl = "private"
  10. force_destroy = var.instance_termination_protection ? false : true # reverse of termination protection, destroy if no termination protection
  11. server_side_encryption_configuration {
  12. rule {
  13. apply_server_side_encryption_by_default {
  14. kms_master_key_id = aws_kms_key.s3.arn
  15. sse_algorithm = "aws:kms"
  16. }
  17. }
  18. }
  19. }
  20. resource "aws_s3_bucket_public_access_block" "awsconfig_bucket_block_public_access" {
  21. block_public_acls = true
  22. block_public_policy = true
  23. bucket = aws_s3_bucket.storage.id
  24. ignore_public_acls = true
  25. restrict_public_buckets = true
  26. }