From 0af68e806a5545350b83489526fac4e3519859b1 Mon Sep 17 00:00:00 2001 From: bread <75878656+broadeditz@users.noreply.github.com> Date: Thu, 5 Oct 2023 17:39:23 +0200 Subject: [PATCH] add replicas as variable --- terraform/irc-reader/config.template.yaml | 2 +- terraform/irc-reader/irc-reader.tf | 4 ++-- terraform/irc-reader/variables.tf | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/terraform/irc-reader/config.template.yaml b/terraform/irc-reader/config.template.yaml index c65bc6e..84d0215 100644 --- a/terraform/irc-reader/config.template.yaml +++ b/terraform/irc-reader/config.template.yaml @@ -1,5 +1,5 @@ loglevel: info -replicas: %{replicas} +replicas: ${replicas} ratelimit: join: ${ratelimit_join} diff --git a/terraform/irc-reader/irc-reader.tf b/terraform/irc-reader/irc-reader.tf index 9fd2c9e..1cab916 100644 --- a/terraform/irc-reader/irc-reader.tf +++ b/terraform/irc-reader/irc-reader.tf @@ -38,7 +38,7 @@ resource "kubernetes_secret" "app" { data = { "config.yaml" = templatefile("${path.module}/config.template.yaml", { - replicas = 3 + replicas = var.replicas twitch_username = var.twitch_username twitch_oauth = join(":", ["oauth", base64decode(data.kubernetes_secret.oauth.binary_data["access-token"])]) ratelimit_join = var.ratelimit_join @@ -103,7 +103,7 @@ resource "kubernetes_stateful_set" "app" { } } - replicas = 3 + replicas = var.replicas service_name = kubernetes_service.app.metadata[0].name template { diff --git a/terraform/irc-reader/variables.tf b/terraform/irc-reader/variables.tf index 51b9c8c..d2a4c93 100644 --- a/terraform/irc-reader/variables.tf +++ b/terraform/irc-reader/variables.tf @@ -5,6 +5,11 @@ variable "namespace" { default = "app" } +variable replicas { + type = number + default = 3 +} + variable "oauth_secret" { type = string default = ""