Skip to content

Commit

Permalink
Merge pull request #81 from Vermyndax/dev
Browse files Browse the repository at this point in the history
Add current user to canonical perms
  • Loading branch information
Vermyndax authored Mar 23, 2021
2 parents 60924d1 + 5802e99 commit bffa855
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ No Modules.

| Name |
|------|
| [aws_canonical_user_id](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/canonical_user_id) |
| [aws_cloudfront_distribution](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudfront_distribution) |
| [aws_route53_record](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) |
| [aws_route53_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) |
Expand Down
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ resource "aws_s3_bucket" "site_www_redirect" {
}

# S3 bucket for CloudFront logging

data "aws_canonical_user_id" "current" {}

resource "aws_s3_bucket" "site_cloudfront_logs" {
bucket = "${var.site_tld}-cloudfront-logs"
# region = var.site_region
Expand All @@ -88,6 +91,12 @@ resource "aws_s3_bucket" "site_cloudfront_logs" {
type = "CanonicalUser"
permissions = ["FULL_CONTROL"]
}

grant {
id = data.aws_canonical_user_id.current.id
type = "CanonicalUser"
permissions = ["FULL_CONTROL"]
}
}

resource "aws_s3_bucket_public_access_block" "cloudfront_logs_block" {
Expand Down

0 comments on commit bffa855

Please sign in to comment.