File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,17 @@ resource "aws_s3_bucket" "bucket" {
22 bucket = var. domain
33}
44
5+ resource "aws_s3_bucket_logging" "bucket_logging" {
6+ bucket = aws_s3_bucket. bucket . id
7+
8+ target_bucket = aws_s3_bucket. logs . id
9+ target_prefix = " s3-access-logs/"
10+ }
11+
12+ resource "aws_s3_bucket" "logs" {
13+ bucket = " ${ var . domain } -logs"
14+ }
15+
516resource "aws_s3_bucket_ownership_controls" "bucket" {
617 bucket = aws_s3_bucket. bucket . id
718 rule {
@@ -70,6 +81,13 @@ resource "aws_cloudfront_distribution" "distribution" {
7081 is_ipv6_enabled = true
7182 price_class = " PriceClass_100"
7283
84+ logging_config {
85+ include_cookies = false
86+ bucket = " ${ aws_s3_bucket . logs . bucket_regional_domain_name } "
87+ prefix = " cloudfront/"
88+ }
89+
90+
7391 origin {
7492 domain_name = aws_s3_bucket_website_configuration. bucket . website_endpoint
7593 origin_id = aws_s3_bucket. bucket . bucket_regional_domain_name
You can’t perform that action at this time.
0 commit comments