Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions terraform/modules/happy-cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
| <a name="input_cache_policy_id"></a> [cache\_policy\_id](#input\_cache\_policy\_id) | The cache policy ID for the CloudFront distribution. | `string` | `"4135ea2d-6df8-44a3-9df3-4b5a84be39ad"` | no |
| <a name="input_frontend"></a> [frontend](#input\_frontend) | The domain name and zone ID the user will see. | <pre>object({<br> domain_name = string<br> zone_id = string<br> })</pre> | n/a | yes |
| <a name="input_geo_restriction_locations"></a> [geo\_restriction\_locations](#input\_geo\_restriction\_locations) | The countries to whitelist for the CloudFront distribution. | `set(string)` | <pre>[<br> "US"<br>]</pre> | no |
| <a name="input_geo_restriction_type"></a> [geo\_restriction\_type](#input\_geo\_restriction\_type) | The type of geo\_restriction to implement. Allowed restriction types: none, whitelist, or blacklist. | `string` | `"whitelist"` | no |
| <a name="input_origin_request_policy_id"></a> [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 |
| <a name="input_origins"></a> [origins](#input\_origins) | The domain names and the path used for the origin. | <pre>list(object({<br> domain_name = string<br> path_pattern = string<br> s3_origin_config = optional(object({ origin_access_identity = string }))<br> origin_access_control_id = optional(string)<br> }))</pre> | n/a | yes |
| <a name="input_price_class"></a> [price\_class](#input\_price\_class) | The price class for the CloudFront distribution. | `string` | `"PriceClass_100"` | no |
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/happy-cloudfront/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a chance you will need multiple restrictions with different restriction types?

Copy link
Contributor Author

@kuannie1 kuannie1 Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly. I'll talk to you about them.

}
}

Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/happy-cloudfront/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
Loading