You must be logged in to view saved presets
This template creates an ECR lifecycle policy to expire untagged images older than 14 days.
resource "aws_ecr_lifecycle_policy" "example" {
policy = <<-EOF
{
"rules": [
{
"rulePriority": 1,
"description": "Expire images older than 14 days",
"selection": {
"tagStatus": "untagged",
"countType": "sinceImagePushed",
"countUnit": "days",
"countNumber": 14
},
"action": {
"type": "expire"
}
}
]
}
EOF
repository = aws_ecr_repository.example.name
}
resource "aws_ecr_repository" "example" {
name = "example-repo"
}