diff --git a/terraform/modules/happy-cloudfront/README.md b/terraform/modules/happy-cloudfront/README.md index b3521c6b4d..5061654809 100644 --- a/terraform/modules/happy-cloudfront/README.md +++ b/terraform/modules/happy-cloudfront/README.md @@ -37,6 +37,7 @@ | [cache\_policy\_id](#input\_cache\_policy\_id) | The cache policy ID for the CloudFront distribution. | `string` | `"4135ea2d-6df8-44a3-9df3-4b5a84be39ad"` | no | | [frontend](#input\_frontend) | The domain name and zone ID the user will see. |
object({
domain_name = string
zone_id = string
}) | n/a | yes |
| [geo\_restriction\_locations](#input\_geo\_restriction\_locations) | The countries to whitelist for the CloudFront distribution. | `set(string)` | [| no | +| [geo\_restriction\_type](#input\_geo\_restriction\_type) | The type of geo\_restriction to implement. Allowed restriction types: none, whitelist, or blacklist. | `string` | `"whitelist"` | no | | [origin\_request\_policy\_id](#input\_origin\_request\_policy\_id) | The origin request policy ID for the CloudFront distribution. | `string` | `"b689b0a8-53d0-40ab-baf2-68738e2966ac"` | no | | [origins](#input\_origins) | The domain names and the path used for the origin. |
"US"
]
list(object({
domain_name = string
path_pattern = string
s3_origin_config = optional(object({ origin_access_identity = string }))
origin_access_control_id = optional(string)
})) | n/a | yes |
| [price\_class](#input\_price\_class) | The price class for the CloudFront distribution. | `string` | `"PriceClass_100"` | no |
diff --git a/terraform/modules/happy-cloudfront/main.tf b/terraform/modules/happy-cloudfront/main.tf
index 5e84cf00d9..9e118c3639 100644
--- a/terraform/modules/happy-cloudfront/main.tf
+++ b/terraform/modules/happy-cloudfront/main.tf
@@ -68,7 +68,7 @@ resource "aws_cloudfront_distribution" "this" {
restrictions {
geo_restriction {
locations = var.geo_restriction_locations
- restriction_type = "whitelist"
+ restriction_type = var.geo_restriction_type
}
}
diff --git a/terraform/modules/happy-cloudfront/variables.tf b/terraform/modules/happy-cloudfront/variables.tf
index 8504a7458a..dd039ba72e 100644
--- a/terraform/modules/happy-cloudfront/variables.tf
+++ b/terraform/modules/happy-cloudfront/variables.tf
@@ -37,6 +37,12 @@ variable "geo_restriction_locations" {
description = "The countries to whitelist for the CloudFront distribution."
}
+variable "geo_restriction_type" {
+ type = string
+ default = "whitelist"
+ description = "The type of geo_restriction to implement. Allowed restriction types: none, whitelist, or blacklist."
+}
+
variable "cache_allowed_methods" {
type = set(string)
default = ["GET", "HEAD"]