terraform/ecc-aws-492-ecr_private_lifecycle_policy_configured/green/ecr.tf (25 lines of code) (raw):

resource "aws_ecr_repository" "this" { name = "492_ecr_repository_green" } resource "aws_ecr_lifecycle_policy" "this" { repository = aws_ecr_repository.this.name 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 }