mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
30 lines
No EOL
735 B
HCL
30 lines
No EOL
735 B
HCL
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
|
|
}
|
|
}
|
|
|
|
resource "aws_ecr_lifecycle_policy" "my_repository_policy" {
|
|
repository = aws_ecr_repository.my_repository.name
|
|
|
|
policy = jsonencode({
|
|
rules = [
|
|
{
|
|
rulePriority = 1
|
|
description = "Retain only the last 10 images"
|
|
selection = {
|
|
tagStatus = "any"
|
|
countType = "imageCountMoreThan"
|
|
countNumber = 10
|
|
}
|
|
action = {
|
|
type = "expire"
|
|
}
|
|
}
|
|
]
|
|
})
|
|
} |