-
Notifications
You must be signed in to change notification settings - Fork 25
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
Enable logging with private s3 bucket #210
Conversation
aws-s3-private-bucket/main.tf
Outdated
@@ -1,6 +1,8 @@ | |||
locals { | |||
# If grants are defined, we use `grant` to grant permissions, otherwise it will use the `acl` to grant permissions | |||
acl = length(var.grants) == 0 ? "private" : null | |||
acl = length(var.grants) == 0 ? "private" : ( | |||
var.log_delivery_write_acl_enable ? "log-delivery-write" : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this needs a fix -- the log delivery flag will only work here if we have grants AND log_delivery_write_acl_enable set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redid, but had to put in a try because hashicorp/terraform#25014
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did find this: hashicorp/terraform#22131 (comment), which is what I had previously.
Ok, this looks like a good start to me -- let's test it in the cellxgene dev environment before merging. |
aws-s3-private-bucket/variables.tf
Outdated
variable log_delivery_write_acl_enable { | ||
type = bool | ||
default = false | ||
description = "Enables logging" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a more descriptive description?
aws-cloudfront-logs-bucket/main.tf
Outdated
# Define the grant ACL for the Cloudfront logging S3 bucket, | ||
# In order for the awslogsdelivery account to write log files to the bucket, | ||
# we need to grant the AWS log delivery group the FULL_CONTROL access to the logging bucket | ||
# LP's AWS account also has the FULL_CONTROL access to the bucket, this is specified by the canonical user id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is confusing -- please remove the reference to LP
Summary
This doc describes that if you remove permissions for the
awslogsdelivery
account, CloudFront won't be able to save logs to the S3 bucket. Terraform is wiping this out every time we update s3 buckets. We have to explicitly create grants toawslogsdelivery
. Inspired by: https://github.com/FB-PLP/terraform-infra-management/pull/386, creating a module for this so that it will be easier to configure.Test Plan
Updating a module that is referencing this module and seeing if logs show up (since they have disappeared when buckets were updated last). Tests in go.