Skip to content

Commit

Permalink
Merge pull request #320 from ministryofjustice/ND-283-ecr-lifecycle-p…
Browse files Browse the repository at this point in the history
…olicy-staff-device-dns-dhcp-admin

Added lifecycle policy
  • Loading branch information
laurentb4 authored Apr 25, 2024
2 parents 5478434 + 8536296 commit 01b964b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions modules/admin/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ resource "aws_ecr_repository_policy" "admin_docker_dhcp_repository_policy" {
EOF
}

resource "aws_ecr_lifecycle_policy" "lifecycle_policy" {
repository = aws_ecr_repository.admin_ecr.name

policy = <<EOF
{
"rules": [
{
"rulePriority": 1,
"description": "Expire older versions of untagged images, keeping the latest 15",
"selection": {
"tagStatus": "untagged",
"countType": "imageCountMoreThan",
"countNumber": 15
},
"action": {
"type": "expire"
}
}
]
}
EOF
}

resource "aws_ecs_task_definition" "admin_task" {
family = "${var.prefix}-task"
requires_compatibilities = ["FARGATE"]
Expand Down

0 comments on commit 01b964b

Please sign in to comment.