Cloudformation ECR Repository syntax
Early decision by AWS to make the LifecyclePolicy a Type: String instead of Json means there is no easy way to use native yaml in a cloudformation template to format the rules.
Solution:
ECRRepository2:
Type: AWS::ECR::Repository
Properties:
ImageScanningConfiguration:
ScanOnPush: True
ImageTagMutability: MUTABLE
LifecyclePolicy:
#poor aws design..lifecycle policy text is a string, not type: json
LifecyclePolicyText: |
{"rules": [
{"rulePriority": 1,
"description": "Remove older versions",
"selection": {
"tagStatus": "any",
"countType": "imageCountMoreThan",
"countNumber": 10 },
"action": {
"type": "expire" }
}]}