Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Added apiary_extra_tags_s3 variable to the s3 checkpoint bucket to add extra tags #284

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ locals {
enable_apiary_s3_log_management = var.apiary_log_bucket == "" ? true : false
enable_apiary_s3_log_hive = var.apiary_log_bucket == "" && var.enable_apiary_s3_log_hive ? true : false
apiary_s3_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_bucket_prefix}-s3-logs" : ""
apiary_s3_logs_checkpoint_bucket= "${local.apiary_bucket_prefix}-s3-logs-checkpoint"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a space before the = and then align the rest of the assignments too please

Suggested change
apiary_s3_logs_checkpoint_bucket= "${local.apiary_bucket_prefix}-s3-logs-checkpoint"
apiary_s3_logs_checkpoint_bucket = "${local.apiary_bucket_prefix}-s3-logs-checkpoint"

apiary_s3_hive_logs_bucket = local.enable_apiary_s3_log_management ? "${local.apiary_s3_logs_bucket}-hive" : ""
apiary_system_bucket = "${local.apiary_bucket_prefix}-${replace(var.system_schema_name, "_", "-")}"

Expand Down
41 changes: 41 additions & 0 deletions s3-other.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,47 @@ EOF
}
}

resource "aws_s3_bucket" "s3_logs_checkpoint" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog please

bucket = local.apiary_s3_logs_checkpoint_bucket
acl = "log-delivery-write"
tags = merge(tomap({"Name"="s3_logs_checkpoint"}), var.apiary_tags, var.apiary_extra_tags_s3)
policy = <<EOF
{
"Version":"2012-10-17",
"Statement":[
{
"Sid": "DenyUnSecureCommunications",
"Effect": "Deny",
"Principal": {"AWS": "*"},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::s3_logs_checkpoint",
"arn:aws:s3:::s3_logs_checkpoint/*"
],
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}
]
}
EOF
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

lifecycle_rule {
enabled = true

abort_incomplete_multipart_upload_days = var.s3_lifecycle_abort_incomplete_multipart_upload_days
}
}

resource "aws_s3_bucket_public_access_block" "apiary_managed_logs_bucket" {
count = local.enable_apiary_s3_log_management ? 1 : 0
bucket = aws_s3_bucket.apiary_managed_logs_bucket[0].bucket
Expand Down
Loading