<commit_before># Copyright (C) 2021 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# resource "aws_s3_bucket" "logs" {
#   bucket = local.alb_logs_bucket_name
#   acl    = "private"

#   policy = <<POLICY
# {
#   "Id": "Policy",
#   "Version": "2012-10-17",
#   "Statement": [
#     {
#       "Action": [
#         "s3:PutObject"
#       ],
#       "Effect": "Allow",
#       "Resource": "arn:aws:s3:::${var.alb_name}/*",
#       "Principal": {
#         "AWS": [
#           "${data.aws_elb_service_account.this.arn}"
#         ]
#       }
#     }
#   ]
# }
# POLICY
#   tags = merge({
#     "Name" = var.alb_name
#     "Role" = "logs"
#   }, var.alb_tags)
# }


#tfsec:ignore:AWS073
#tfsec:ignore:AWS074
#tfsec:ignore:AWS075
#tfsec:ignore:AWS076
module "logs" {
  source  = "terraform-aws-modules/s3-bucket/aws"
  version = "2.11.1"

  bucket = local.alb_logs_bucket_name
  acl    = "log-delivery-write"

  # Allow deletion of non-empty bucket
  force_destroy = true

  attach_elb_log_delivery_policy = true # Required for ALB logs
  attach_lb_log_delivery_policy  = true # Required for ALB/NLB logs

  versioning = {
    enabled = true
  }

  policy = <<POLICY
  {
    "Id": "Policy",
    "Version": "2012-10-17",
    "Statement": [
      {
        "Action": [
          "s3:PutObject"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::${var.alb_name}/*",
        "Principal": {
          "AWS": [
            "${data.aws_elb_service_account.this.arn}"
          ]
        }<commit_msg>Update Terraform terraform-aws-modules/s3-bucket/aws to v2.12.0 (#1565)<commit_after># Copyright (C) 2021 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# resource "aws_s3_bucket" "logs" {
#   bucket = local.alb_logs_bucket_name
#   acl    = "private"

#   policy = <<POLICY
# {
#   "Id": "Policy",
#   "Version": "2012-10-17",
#   "Statement": [
#     {
#       "Action": [
#         "s3:PutObject"
#       ],
#       "Effect": "Allow",
#       "Resource": "arn:aws:s3:::${var.alb_name}/*",
#       "Principal": {
#         "AWS": [
#           "${data.aws_elb_service_account.this.arn}"
#         ]
#       }
#     }
#   ]
# }
# POLICY
#   tags = merge({
#     "Name" = var.alb_name
#     "Role" = "logs"
#   }, var.alb_tags)
# }


#tfsec:ignore:AWS073
#tfsec:ignore:AWS074
#tfsec:ignore:AWS075
#tfsec:ignore:AWS076
module "logs" {
  source  = "terraform-aws-modules/s3-bucket/aws"
  version = "2.12.0"

  bucket = local.alb_logs_bucket_name
  acl    = "log-delivery-write"

  # Allow deletion of non-empty bucket
  force_destroy = true

  attach_elb_log_delivery_policy = true # Required for ALB logs
  attach_lb_log_delivery_policy  = true # Required for ALB/NLB logs

  versioning = {
    enabled = true
  }

  policy = <<POLICY
  {
    "Id": "Policy",
    "Version": "2012-10-17",
    "Statement": [
      {
        "Action": [
          "s3:PutObject"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::${var.alb_name}/*",
        "Principal": {
          "AWS": [
            "${data.aws_elb_service_account.this.arn}"
          ]
        }
{'fraction_non_alphanumeric': 0.14778804083616917, 'fraction_numerical': 0.024550315994166263, 'mean_word_length': 2.6708296164139163, 'pattern_counts': {'":': 32, '<': 17, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '912244', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1438, 'n_words': 339}