-
Notifications
You must be signed in to change notification settings - Fork 0
/
cf-hitman-common.yml
96 lines (84 loc) · 2.42 KB
/
cf-hitman-common.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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
AWSTemplateFormatVersion: '2010-09-09'
Description: Common resources for Hitman
# Stack Name : hitman-common
# Description : this stack creates the Hitman main stack prerequisites :
# - one ECR repository
# - one S3 bucket
Parameters:
TagBlock:
Description: Applicative block tag
Type: String
Default: sharedservices
TagApp:
Description: Application referenced by this stack
Type: String
Default: hitman
TagOrg:
Description: Organization Unit
Type: String
Default: cloudteam
HitmanEcrRepoName:
Description: Organization Unit
Type: String
Default: hitman
DaysToRetainUntaggedContainerImages:
Description: Days to retain untagged images
Type: String
Default: 1
Resources:
HitmanEcrRepository:
Type: AWS::ECR::Repository
Properties:
RepositoryName: !Ref HitmanEcrRepoName
Tags:
- Key: Block
Value: !Ref TagBlock
- Key: App
Value: !Ref TagApp
- Key: Org
Value: !Ref TagOrg
LifecyclePolicy:
LifecyclePolicyText: !Sub
- |
{
"rules": [
{
"rulePriority": 1,
"description": "Only keep untagged images for ${DaysToRetainUntaggedContainerImages} days",
"selection": {
"tagStatus": "untagged",
"countType": "sinceImagePushed",
"countUnit": "days",
"countNumber": ${DaysToRetainUntaggedContainerImages}
},
"action": { "type": "expire" }
}
]
}
- DaysToRetainUntaggedContainerImages: !Ref DaysToRetainUntaggedContainerImages
HitmanS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub '${TagApp}-conf-${AWS::AccountId}'
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
Tags:
- Key: Block
Value: !Ref TagBlock
- Key: App
Value: !Ref TagApp
- Key: Org
Value: !Ref TagOrg
Outputs:
HitmanEcrRepository:
Description: Hitman ECR repository
Value: !GetAtt HitmanEcrRepository.Arn
Export:
Name: !Sub "${AWS::StackName}-EcrRepository"
HitmanS3Bucket:
Description: Hitman S3 bucket
Value: !GetAtt HitmanS3Bucket.Arn
Export:
Name: !Sub "${AWS::StackName}-S3Bucket"