Skip to content

Commit

Permalink
Parameterize some values to allow more tailored deployments
Browse files Browse the repository at this point in the history
- TLS protocol version
- Custom error responses
  • Loading branch information
andysingleton committed Jun 19, 2024
1 parent cc0ae38 commit 507164a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
8 changes: 4 additions & 4 deletions aws_cloudfront_distribution.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
cloudfront_default_certificate = var.use_cloudfront_default_certificate
acm_certificate_arn = aws_acm_certificate.certificate.arn
ssl_support_method = "sni-only"
minimum_protocol_version = "TLSv1.2_2021"
minimum_protocol_version = var.minimum_protocol_version
}

custom_error_response {
error_caching_min_ttl = 300
error_code = 404
response_code = 200
error_caching_min_ttl = var.custom_error_response_min_ttl
error_code = var.custom_error_response_error_code
response_code = var.custom_error_response_code
response_page_path = "/index.html"
}

Expand Down
30 changes: 27 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,31 @@ variable "cloudfront_cache_compress_content" {
default = false
}

variable "custom_error_response_error_code" {
description = "Custom error code for error response"
type = number
default = 404
}

variable "custom_error_response_min_ttl" {
description = "Minimum time-to-live for error caching"
type = number
default = 300
}

variable "custom_error_response_code" {
description = "Custom error code for error response"
type = number
default = 200
}

variable "distribution_fqdn" {
type = string
description = "Fully qualified domain bound to Cloudfront."
}

variable "distribution_name" {
type = string
type = string
description = "A unique name give to the distribution."
}

Expand All @@ -37,10 +55,16 @@ variable "hosted_zone_name" {
description = "The route53 zone."
}

variable "minimum_protocol_version" {
description = "Minimum protocol version for the viewer certificate"
type = string
default = "TLSv1.2_2021"
}

variable "price_class" {
type = string
type = string
description = "The price class for this distribution."
default = "PriceClass_100"
default = "PriceClass_100"
}

variable "s3_source_bukcet_name" {
Expand Down

0 comments on commit 507164a

Please sign in to comment.