-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathecr.tf
70 lines (60 loc) · 1.78 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# ECR (Elastic Container Registry)
#
# All our code is run as tasks on ECS, which means they need repositories to
# store the container images. Images are built and published to these
# repositories by GitHub Actions.
locals {
ecr_keep_10_images_policy = <<EOF
{
"rules": [
{
"rulePriority": 1,
"description": "Keep last 10 images",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 10
},
"action": {
"type": "expire"
}
}
]
}
EOF
}
resource "aws_ecr_repository" "server_repository" {
name = "univaf-server"
image_tag_mutability = "IMMUTABLE"
image_scanning_configuration {
scan_on_push = false
}
}
resource "aws_ecr_lifecycle_policy" "server_repository" {
repository = aws_ecr_repository.server_repository.name
policy = local.ecr_keep_10_images_policy
}
resource "aws_ecr_repository" "loader_repository" {
name = "univaf-loader"
image_tag_mutability = "IMMUTABLE"
image_scanning_configuration {
scan_on_push = false
}
}
resource "aws_ecr_lifecycle_policy" "loader_repository" {
repository = aws_ecr_repository.loader_repository.name
policy = local.ecr_keep_10_images_policy
}
# This repository is maintained only for historical reference. The seed image
# should not actually ever be used in production.
resource "aws_ecr_repository" "seed_repository" {
name = "univaf-db-seed"
image_tag_mutability = "IMMUTABLE"
image_scanning_configuration {
scan_on_push = false
}
}
resource "aws_ecr_lifecycle_policy" "seed_repository" {
repository = aws_ecr_repository.seed_repository.name
policy = local.ecr_keep_10_images_policy
}