diff --git a/ops/modules/ecr/main.tf b/ops/modules/ecr/main.tf index ea7e2683..0d89cc56 100644 --- a/ops/modules/ecr/main.tf +++ b/ops/modules/ecr/main.tf @@ -53,3 +53,31 @@ resource "aws_ecr_lifecycle_policy" "mark_admin" { }] }) } + +resource "aws_ecr_repository" "mark_handler" { + name = "mark-handler" + image_tag_mutability = "MUTABLE" + + image_scanning_configuration { + scan_on_push = true + } +} + +resource "aws_ecr_lifecycle_policy" "mark_handler" { + repository = aws_ecr_repository.mark_handler.name + + policy = jsonencode({ + rules = [{ + rulePriority = 1 + description = "Keep last 30 images" + selection = { + tagStatus = "any" + countType = "imageCountMoreThan" + countNumber = 30 + } + action = { + type = "expire" + } + }] + }) +} diff --git a/ops/modules/ecr/outputs.tf b/ops/modules/ecr/outputs.tf index 4f644285..f7f9d33a 100644 --- a/ops/modules/ecr/outputs.tf +++ b/ops/modules/ecr/outputs.tf @@ -6,4 +6,9 @@ output "mark_poller_repository_url" { output "mark_admin_repository_url" { description = "URL of the Mark Admin API ECR repository" value = aws_ecr_repository.mark_admin.repository_url +} + +output "mark_handler_repository_url" { + description = "URL of the Mark Handler ECR repository" + value = aws_ecr_repository.mark_handler.repository_url } \ No newline at end of file