Skip to content

Instantly share code, notes, and snippets.

@dev-daeun
Created February 19, 2022 07:05
Show Gist options
  • Save dev-daeun/27626fc08ad7848f23975bf94413fc1d to your computer and use it in GitHub Desktop.
Save dev-daeun/27626fc08ad7848f23975bf94413fc1d to your computer and use it in GitHub Desktop.
resource "aws_ecr_lifecycle_policy" "ecr-lifecycle-policy" {
repository = aws_ecr_repository.ecr-repo.name
policy = jsonencode({
rules = [
{
rulePriority = 1,
description = "Expire images older than 30 days",
selection = {
tagStatus = "any",
countType = "sinceImagePushed",
countUnit = "days",
countNumber = 30
}
action = {
type = "expire"
}
}
]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment