-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudformation.yml
41 lines (41 loc) · 1.15 KB
/
cloudformation.yml
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
---
AWSTemplateFormatVersion: '2010-09-09'
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: ECR Settings
Parameters:
- RepositoryName
- DaysToRetainUntaggedImages
Parameters:
RepositoryName:
Description: The name of the ECR repository.
Type: String
Default: methyldackel
DaysToRetainUntaggedImages:
Description: The number of days to retain untagged images.
Type: Number
Default: 7
Resources:
Repository:
Type: "AWS::ECR::Repository"
Properties:
RepositoryName: !Ref RepositoryName
LifecyclePolicy:
LifecyclePolicyText: !Sub |
{
"rules": [
{
"rulePriority": 1,
"description": "Only keep untagged images for ${DaysToRetainUntaggedImages} days",
"selection": {
"tagStatus": "untagged",
"countType": "sinceImagePushed",
"countUnit": "days",
"countNumber": ${DaysToRetainUntaggedImages}
},
"action": { "type": "expire" }
}
]
}