I see that the ECR input type LifecyclePolicySelec...
# aws
l
I see that the ECR input type LifecyclePolicySelection doesn’t have tagPatternList, only tagPrefixList. Is this intentional? AWS asserts “When creating a lifecycle policy for tagged images, it’s best practice to use a tagPatternList to specify the tags to expire” (https://docs.aws.amazon.com/AmazonECR/latest/userguide/lifecycle_policy_parameters.html), but right now, do we have to use tagPrefixList? I presume it’s safe to workaround by casting to unknown and back again.. but meh.
f
hm this worked for me as a workaround
Copy code
const repo = new aws.ecr.Repository("lifecycle-test", {
    forceDelete: true,
});
const doc = aws.ecr.getLifecyclePolicyDocumentOutput({
    rules: [{
        priority: 1,
        description: "Expire v* images beyond the latest 5",
        selection: {
            tagStatus: "tagged",
            tagPatternLists: ["v*"],
            countType: "imageCountMoreThan",
            countNumber: 5,
        },
        action: { type: "expire" },
    }],
});

new aws.ecr.LifecyclePolicy("policy-a", {
    repository: repo.name,
    policy: doc.json,
});
does feel like
tagPatternList
should be present. is it upstream I wonder?
I do see
tag_pattern_list
. I’ve been assuming
pulumi-aws
- probably good to file an issue for this
l
This seems to be the same issue, but implemented in only one of the several places needed: https://github.com/pulumi/pulumi-aws/issues/5119 There’s been other work in this area (the content of lifecyclePolicyDocument.ts has been moved to types/inputs.ts) but that’s effectively made fixing this harder, since now the fix is in a million-line file. I volunteer to not raise the PR 🙂 I’ll raise an issue instead.