From 9136fce412726ed9f60a9c1389faa085f8863a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Poniedzia=C5=82ek?= Date: Fri, 19 Apr 2024 12:31:07 +0200 Subject: [PATCH] Add configurable Iglu cache size and TTL --- main.tf | 6 +++++- templates/iglu_resolver.json.tmpl | 4 ++-- variables.tf | 10 ++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 84c0b75..6f9965b 100644 --- a/main.tf +++ b/main.tf @@ -168,7 +168,11 @@ locals { local.resolvers_closed ]) - iglu_resolver = templatefile("${path.module}/templates/iglu_resolver.json.tmpl", { resolvers = jsonencode(local.resolvers) }) + iglu_resolver = templatefile("${path.module}/templates/iglu_resolver.json.tmpl", { + resolvers = jsonencode(local.resolvers) + cache_size = var.iglu_cache_size + cache_ttl = var.iglu_cache_ttl_seconds + }) hocon = templatefile("${path.module}/templates/config.json.tmpl", { project_id = var.project_id diff --git a/templates/iglu_resolver.json.tmpl b/templates/iglu_resolver.json.tmpl index f266ad8..cc7980f 100644 --- a/templates/iglu_resolver.json.tmpl +++ b/templates/iglu_resolver.json.tmpl @@ -1,8 +1,8 @@ { "schema": "iglu:com.snowplowanalytics.iglu/resolver-config/jsonschema/1-0-2", "data": { - "cacheSize": 500, - "cacheTtl": 600, + "cacheSize": ${cache_size}, + "cacheTtl": ${cache_ttl}, "repositories": ${resolvers} } } diff --git a/variables.tf b/variables.tf index e42a6a5..b6a544c 100644 --- a/variables.tf +++ b/variables.tf @@ -173,6 +173,16 @@ variable "custom_iglu_resolvers" { })) } +variable "iglu_cache_size" { + type = number + default = 500 +} + +variable "iglu_cache_ttl_seconds" { + type = number + default = 600 +} + # --- Telemetry variable "telemetry_enabled" {