Terraform module to create an S3 bucket for storing service logs:
- S3
- CloudFront
- ALB
bucket
- Bucket name.force_destroy
- Allow remove bucket with its content (Default:false
).readers
- A list of AWS accounts who can read from bucket (Default:[]
).cdn_logs_path
- Prefix for CloudFront logs (Default:cdn
)alb_logs_path
- Prefix for ALB logs (Default:alb
)s3_logs_path
- Prefix for S3 access logs (Default:s3
)
Example
module "log_storage" {
source = "github.com/jetbrains-infra/terraform-aws-s3-bucket-for-logs?ref=X.X.X" // see https://github.com/jetbrains-infra/terraform-aws-s3-bucket-for-logs/releases/latest
bucket = "example-logs"
}
resource "aws_s3_bucket" "example" {
bucket = "example"
logging {
target_bucket = module.log_storage.s3_logs_bucket
target_prefix = module.log_storage.s3_logs_path
}
}
Default values
module "log_storage" {
source = "github.com/jetbrains-infra/terraform-aws-s3-bucket-for-logs?ref=X.X.X" // see https://github.com/jetbrains-infra/terraform-aws-s3-bucket-for-logs/releases/latest
bucket = "example-logs"
force_destroy = false
readers = []
}
bucket_arn
- S3 bucket ARN.
cdn_logs_bucket
- Bucket for CloudFront distribution.cdn_logs_path
- Prefix for CloudFront logs (Defaultcdn
).
alb_logs_bucket
- Bucket for ALB.alb_logs_path
- Prefix for ALB logs (Defaultalb
).
s3_logs_bucket
- Bucket for S3 :)s3_logs_path
- Prefix for S3 access logs (Defaults3
).