Skip to content

Commit

Permalink
Merge pull request #19 from mojeto/price-class
Browse files Browse the repository at this point in the history
Makes CloudFront price class configurable.
  • Loading branch information
MattiasGees authored Mar 13, 2018
2 parents 4ad4a7a + d2e06a9 commit 8adec6c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ See the [Terraform Modules documentation](https://www.terraform.io/docs/modules/
* `environment`: (Optional) the environment this site belongs to. Default value = `default`
* `tags`: (Optional) Additional key/value pairs to set as tags.
* `forward-query-string`: (Optional) Forward the query string to the origin. Default value = `false`
* `price_class`: (Optional) The price class that corresponds with the maximum price that you want to pay for CloudFront service.
Read [pricing page](https://aws.amazon.com/cloudfront/pricing/) for more details.
Options: `PriceClass_100` | `PriceClass_200` | `PriceClass_All`. Default value = `PriceClass_200`

### Outputs

Expand Down Expand Up @@ -137,6 +140,9 @@ See the [Terraform Modules documentation](https://www.terraform.io/docs/modules/
* `project`: (Optional) the name of a project this site belongs to. Default value = `noproject`
* `environment`: (Optional) the environment this site belongs to. Default value = `default`
* `tags`: (Optional) Additional key/value pairs to set as tags.
* `price_class`: (Optional) The price class that corresponds with the maximum price that you want to pay for CloudFront service.
Read [pricing page](https://aws.amazon.com/cloudfront/pricing/) for more details.
Options: `PriceClass_100` | `PriceClass_200` | `PriceClass_All`. Default value = `PriceClass_200`


### Outputs
Expand Down
2 changes: 1 addition & 1 deletion site-main/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ resource "aws_iam_policy_attachment" "site-deployer-attach-user-policy" {
################################################################################################################
resource "aws_cloudfront_distribution" "website_cdn" {
enabled = true
price_class = "PriceClass_200"
price_class = "${var.price_class}"
http_version = "http2"

"origin" {
Expand Down
7 changes: 6 additions & 1 deletion site-main/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@ variable "trusted_signers" {
variable "forward-query-string" {
description = "Forward the query string to the origin"
default = false
}
}

variable "price_class" {
description = "CloudFront price class"
default = "PriceClass_200"
}
2 changes: 1 addition & 1 deletion site-redirect/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ resource "aws_iam_policy_attachment" "staging-site-deployer-attach-user-policy"
################################################################################################################
resource "aws_cloudfront_distribution" "website_cdn" {
enabled = true
price_class = "PriceClass_200"
price_class = "${var.price_class}"
http_version = "http2"

"origin" {
Expand Down
5 changes: 5 additions & 0 deletions site-redirect/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ variable "tags" {
description = "Optional Tags"
default = {}
}

variable "price_class" {
description = "CloudFront price class"
default = "PriceClass_200"
}

0 comments on commit 8adec6c

Please sign in to comment.