feat: add ECR lifecycle policy and additional outputs
- Add lifecycle policy to keep only last 10 images - Export repository ARN and name for cross-stack references
This commit is contained in:
parent
45c77bab2b
commit
639044388f
1 changed files with 30 additions and 0 deletions
|
|
@ -14,6 +14,24 @@ Resources:
|
||||||
RepositoryName: !Ref RepositoryName
|
RepositoryName: !Ref RepositoryName
|
||||||
ImageScanningConfiguration:
|
ImageScanningConfiguration:
|
||||||
ScanOnPush: true
|
ScanOnPush: true
|
||||||
|
LifecyclePolicy:
|
||||||
|
LifecyclePolicyText: |
|
||||||
|
{
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"rulePriority": 1,
|
||||||
|
"description": "Keep last 10 images",
|
||||||
|
"selection": {
|
||||||
|
"tagStatus": "any",
|
||||||
|
"countType": "imageCountMoreThan",
|
||||||
|
"countNumber": 10
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "expire"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
RepositoryPolicyText:
|
RepositoryPolicyText:
|
||||||
Version: "2012-10-17"
|
Version: "2012-10-17"
|
||||||
Statement:
|
Statement:
|
||||||
|
|
@ -32,3 +50,15 @@ Outputs:
|
||||||
Value: !GetAtt Repository.RepositoryUri
|
Value: !GetAtt Repository.RepositoryUri
|
||||||
Export:
|
Export:
|
||||||
Name: BlogDeployment-RepositoryUri
|
Name: BlogDeployment-RepositoryUri
|
||||||
|
|
||||||
|
RepositoryArn:
|
||||||
|
Description: ARN of the ECR repository
|
||||||
|
Value: !GetAtt Repository.Arn
|
||||||
|
Export:
|
||||||
|
Name: BlogDeployment-RepositoryArn
|
||||||
|
|
||||||
|
RepositoryName:
|
||||||
|
Description: Name of the ECR repository
|
||||||
|
Value: !Ref RepositoryName
|
||||||
|
Export:
|
||||||
|
Name: BlogDeployment-RepositoryName
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue