-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecr.tf
45 lines (39 loc) · 1.02 KB
/
ecr.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
resource "aws_ecr_repository" "packy-v2-dev" {
name = "packy-v2-dev"
}
resource "aws_ecr_repository" "packy-v2-prod" {
name = "packy-v2-prod"
}
resource "aws_ecr_repository" "packy-v2-web-dev" {
name = "packy-v2-web-dev"
}
resource "aws_ecr_repository" "packy-v2-web-prod" {
name = "packy-v2-web-prod"
}
resource "aws_ecr_lifecycle_policy" "packy-v2-lifecycle" {
for_each = {
dev = aws_ecr_repository.packy-v2-dev.name
prod = aws_ecr_repository.packy-v2-prod.name
web-dev = aws_ecr_repository.packy-v2-web-dev.name
web-prod = aws_ecr_repository.packy-v2-web-prod.name
}
repository = each.value
policy = <<POLICY
{
"rules": [
{
"rulePriority": 1,
"description": "Expire old images when there are more than 3",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 3
},
"action": {
"type": "expire"
}
}
]
}
POLICY
}