<commit_before>## the bucket where the objects will be stored
resource "aws_s3_bucket" "site_bucket" {
    bucket = "${var.bucket_name}"
    acl = "private"

    website {
        ## required, otherwise accessing /foo/ for /foo/index.html will 404
        index_document = "index.html"
        error_document = "404.html"
    }

    tags {
        jekyll = "true"
    }
}

## policy allowing cloudfront access to the bucket
data "aws_iam_policy_document" "s3_origin_policy" {
    statement {
        actions   = ["s3:GetObject"]
        resources = ["${aws_s3_bucket.site_bucket.arn}/*"]
        principals {
            type        = "*"
            identifiers = [ "*" ]
        }

        condition {
            test = "IpAddress"
            variable = "aws:SourceIp"
            values = [ "${data.aws_ip_ranges.cloudfront.cidr_blocks}" ]

        }
    }
<commit_msg>Use bucket prefix instead of static name<commit_after>## the bucket where the objects will be stored
resource "aws_s3_bucket" "site_bucket" {
    bucket_prefix = "${var.site_name}-"
    acl = "private"

    website {
        ## required, otherwise accessing /foo/ for /foo/index.html will 404
        index_document = "index.html"
        error_document = "404.html"

        ## future: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html
    }

    tags {
        jekyll = "true"
    }
}

## policy allowing cloudfront access to the bucket
data "aws_iam_policy_document" "s3_origin_policy" {
    statement {
        actions   = ["s3:GetObject"]
        resources = ["${aws_s3_bucket.site_bucket.arn}/*"]
        principals {
            type        = "*"
            identifiers = [ "*" ]
        }

        condition {
            test = "IpAddress"
            variable = "aws:SourceIp"
            values = [ "${data.aws_ip_ranges.cloudfront.cidr_blocks}" ]

        }
    }

{'fraction_non_alphanumeric': 0.11946666666666667, 'fraction_numerical': 0.0112, 'mean_word_length': 2.060358890701468, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3574022', 'n_tokens_mistral': 590, 'n_tokens_neox': 567, 'n_words': 122}