Skip to content

Commit

Permalink
Merge pull request #6 from Flaconi/OPS-4317-cloudfront-logging
Browse files Browse the repository at this point in the history
OPS-4317: Enable Cloudfront Logging
  • Loading branch information
vikkasyousaf authored Apr 21, 2021
2 parents ab7afb0 + 7df0bf5 commit 88653d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This module will create cdn endpoint with alias and SSL-certificate
| r53\_hostname | Hostname for CloudFront alias | `string` | n/a | yes |
| r53\_zone\_id | Route53 zone ID to be used for hostname and certificate validation | `string` | n/a | yes |
| s3\_origin\_hostname | Hostname of S3-bucket to be used as origin | `string` | n/a | yes |
| cdn\_logging | Prefix in s3 bucket for cdn logs | `string` | `""` | no |
| s3\_logging\_hostname | Hostname of S3-bucket to be used for logging | `string` | `""` | no |
| tags | Map of custom tags for the provisioned resources | `map(string)` | `{}` | no |

Expand Down
6 changes: 5 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ module "cloudfront" {
s3_bucket = "Access identity for CDN (${var.r53_hostname})"
}

logging_config = var.s3_logging_hostname == "" ? {} : { bucket = var.s3_logging_hostname }
logging_config = var.s3_logging_hostname == "" ? {} : {
bucket = var.s3_logging_hostname
include_cookies = false
prefix = var.cdn_logging
}

origin = {
s3_origin = {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ variable "s3_logging_hostname" {
default = ""
}

variable "cdn_logging" {
description = "Prefix in s3 bucket for cdn logs"
type = string
default = ""
}

variable "r53_hostname" {
description = "Hostname for CloudFront alias"
type = string
Expand Down

0 comments on commit 88653d1

Please sign in to comment.