From 06d9ca679709410166cdc06c7b205bf9642870cc Mon Sep 17 00:00:00 2001 From: vincentwschau <99756290+vincentwschau@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:34:56 -0400 Subject: [PATCH] Make image count configurable. (#103) * Make image count configurable. * Add new line. --- indexer/ecr.tf | 8 ++++---- indexer/variables.tf | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/indexer/ecr.tf b/indexer/ecr.tf index 4cb37c00..440c836d 100644 --- a/indexer/ecr.tf +++ b/indexer/ecr.tf @@ -21,14 +21,14 @@ resource "aws_ecr_lifecycle_policy" "main" { policy = jsonencode({ rules = [{ rulePriority = 1 - description = "keep last 100 images" + description = "keep last ${var.image_count} images" action = { type = "expire" } selection = { tagStatus = "any" countType = "imageCountMoreThan" - countNumber = 100 + countNumber = var.image_count } }] }) @@ -58,14 +58,14 @@ resource "aws_ecr_lifecycle_policy" "lambda_services" { policy = jsonencode({ rules = [{ rulePriority = 1 - description = "keep last 100 images" + description = "keep last ${var.image_count} images" action = { type = "expire" } selection = { tagStatus = "any" countType = "imageCountMoreThan" - countNumber = 100 + countNumber = var.image_count } }] }) diff --git a/indexer/variables.tf b/indexer/variables.tf index 9766a8cf..37f1ed6d 100644 --- a/indexer/variables.tf +++ b/indexer/variables.tf @@ -466,3 +466,9 @@ variable "public_access" { description = "Enables public access of the indexer endpoints." default = true } + +variable "image_count" { + type = number + description = "Number of images to store for ECR, defaults to 100." + default = 100 +}