Skip to content

Commit d2a03f5

Browse files
committed
ttl caching variables add
1 parent 8fd6652 commit d2a03f5

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ No modules.
2525

2626
| Name | Description | Type | Default | Required |
2727
|------|-------------|------|---------|:--------:|
28-
| <a name="input_acm_arn"></a> [acm\_arn](#input\_acm\_arn) | ACM cert arn | `string` | n/a | yes |
28+
| <a name="input_acm_arn"></a> [acm\_arn](#input\_acm\_arn) | ACM cert arn | `string` | n/a | no |
2929
| <a name="input_allowed_methods"></a> [allowed\_methods](#input\_allowed\_methods) | Allowed methods | `list(any)` | <pre>[<br> "GET",<br> "HEAD"<br>]</pre> | no |
3030
| <a name="input_cache_policy_id"></a> [cache\_policy\_id](#input\_cache\_policy\_id) | AWS managed cache policy id | `string` | `""` | no |
3131
| <a name="input_cached_methods"></a> [cached\_methods](#input\_cached\_methods) | Cached methods | `list(any)` | <pre>[<br> "GET",<br> "HEAD"<br>]</pre> | no |
@@ -42,6 +42,9 @@ No modules.
4242
| <a name="input_origin"></a> [origin](#input\_origin) | Origin configuration | `any` | n/a | yes |
4343
| <a name="input_route53_zone_id"></a> [route53\_zone\_id](#input\_route53\_zone\_id) | Route53 zone id | `string` | `""` | no |
4444
| <a name="input_web_acl_id"></a> [web\_acl\_id](#input\_web\_acl\_id) | WAF web ACL id | `string` | `""` | no |
45+
| <a name="input_min_ttl"></a> [min\_ttl](#input\_min\_ttl) | min ttl | `number` | 0 | no |
46+
| <a name="input_max_ttl"></a> [max\_ttl](#input\_max\_ttl) | max ttl | `number` | 86400 | no |
47+
| <a name="input_default_ttl"></a> [default\_ttl](#input\_default\_ttl) | default ttl | `number` | 3600 | no |
4548

4649
## Outputs
4750

cloudfront.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ resource "aws_cloudfront_distribution" "cloudfront" {
6060

6161
viewer_protocol_policy = "redirect-to-https"
6262
compress = true
63-
min_ttl = 0
64-
default_ttl = 3600
65-
max_ttl = 86400
63+
min_ttl = var.min_ttl
64+
max_ttl = var.max_ttl
65+
default_ttl = var.default_ttl
6666

6767
dynamic "forwarded_values" {
6868
for_each = var.cache_policy_id != "" ? [] : [1]

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,22 @@ variable "ipv6" {
9696
description = "ipv6 status"
9797
type = bool
9898
default = false
99+
}
100+
101+
variable "min_ttl" {
102+
description = "minimum ttl value for caching"
103+
type = number
104+
default = 0
105+
}
106+
107+
variable "max_ttl" {
108+
description = "maximum ttl value for caching"
109+
type = number
110+
default = 86400
111+
}
112+
113+
variable "default_ttl" {
114+
description = "default ttl value for caching"
115+
type = number
116+
default = 3600
99117
}

0 commit comments

Comments
 (0)