mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
go back to the old one
This commit is contained in:
parent
9208b3eda4
commit
e069f5d129
1 changed files with 3 additions and 30 deletions
|
|
@ -1,6 +1,7 @@
|
|||
resource "aws_ecr_repository" "my_repository" {
|
||||
name = "${var.ecr_name}"
|
||||
image_tag_mutability = "MUTABLE"
|
||||
# Allows overwriting image tags, change to IMMUTABLE if you want to prevent overwriting
|
||||
|
||||
image_scanning_configuration {
|
||||
scan_on_push = true
|
||||
|
|
@ -12,38 +13,10 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
|||
|
||||
policy = jsonencode({
|
||||
rules = [
|
||||
# 1️⃣ Keep important env tags forever
|
||||
{
|
||||
rulePriority = 1
|
||||
description = "Keep prod, main, dev images forever"
|
||||
selection = {
|
||||
tagStatus = "tagged"
|
||||
tagPrefixList = ["prod", "main", "dev"]
|
||||
}
|
||||
action = {
|
||||
type = "retain"
|
||||
}
|
||||
},
|
||||
|
||||
# 2️⃣ Aggressively expire untagged images
|
||||
{
|
||||
rulePriority = 2
|
||||
description = "Expire untagged images"
|
||||
selection = {
|
||||
tagStatus = "untagged"
|
||||
countType = "imageCountMoreThan"
|
||||
countNumber = 1
|
||||
}
|
||||
action = {
|
||||
type = "expire"
|
||||
}
|
||||
},
|
||||
|
||||
# 3️⃣ Rotate everything else
|
||||
{
|
||||
rulePriority = 3
|
||||
description = "Retain only the last 10 images"
|
||||
selection = {
|
||||
selection = {
|
||||
tagStatus = "any"
|
||||
countType = "imageCountMoreThan"
|
||||
countNumber = 10
|
||||
|
|
@ -54,4 +27,4 @@ resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
|||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue