From 4095b7aca07199043c197c539f2b2409c1e47f6a Mon Sep 17 00:00:00 2001 From: Marcin Wyszynski Date: Sun, 20 Aug 2023 14:39:24 +0200 Subject: [PATCH] Add configurable max values to IaC --- iac/lambda.tf | 2 ++ iac/variables.tf | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/iac/lambda.tf b/iac/lambda.tf index 2f296db..f57f5af 100644 --- a/iac/lambda.tf +++ b/iac/lambda.tf @@ -19,6 +19,8 @@ resource "aws_lambda_function" "autoscaler" { environment { variables = { AUTOSCALING_GROUP_ARN = var.autoscaling_group_arn + AUTOSCALING_MAX_CREATE = var.autoscaling_max_create + AUTOSCALING_MAX_KILL = var.autoscaling_max_kill AUTOSCALING_REGION = data.aws_region.current.name SPACELIFT_API_KEY_ID = var.spacelift_api_key_id SPACELIFT_API_KEY_SECRET_NAME = aws_ssm_parameter.spacelift_api_key_secret.name diff --git a/iac/variables.tf b/iac/variables.tf index 38dbf83..d96774b 100644 --- a/iac/variables.tf +++ b/iac/variables.tf @@ -14,6 +14,18 @@ variable "autoscaling_frequency" { default = 5 } +variable "autoscaling_max_create" { + type = number + description = "Max number of instances to create during a single execution of the autoscaler" + default = 1 +} + +variable "autoscaling_max_kill" { + type = number + description = "Max number of instances to kill during a single execution of the autoscaler" + default = 1 +} + variable "spacelift_api_key_id" { type = string description = "ID of the Spacelift API key to use"