From 4189237d0d9421a1a71066d852d30fa67a89d198 Mon Sep 17 00:00:00 2001 From: Jindrich Skupa Date: Fri, 20 Sep 2024 18:41:04 +0200 Subject: [PATCH] feat(config): allow to configure cache TTL times --- main.tf | 6 +++--- variables.tf | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index e9c65ab..e8a8573 100644 --- a/main.tf +++ b/main.tf @@ -261,9 +261,9 @@ resource "aws_cloudfront_distribution" "this" { } viewer_protocol_policy = "redirect-to-https" - min_ttl = 0 - default_ttl = 3600 - max_ttl = 86400 + min_ttl = var.min_ttl + default_ttl = var.default_ttl + max_ttl = var.max_ttl dynamic "function_association" { for_each = concat( diff --git a/variables.tf b/variables.tf index 327b38e..9443ede 100644 --- a/variables.tf +++ b/variables.tf @@ -107,3 +107,18 @@ variable "origin_path" { default = "" description = "Cloudfront origin path" } + +variable "min_ttl" { + type = number + default = 0 +} + +variable "default_ttl" { + type = number + default = 3600 +} + +variable "max_ttl" { + type = number + default = 86400 +}