Describe the bug
Using the CDK, creating an EventBridge rule on an ECR repository creates a rule with the following event pattern:
{
"resources": ["arn:aws:ecr:ap-southeast-2:<account-id>:repository/my-repository-name"],
"source": ["aws.ecr"]
}
However when ECR sends the event, "resources" is empty, so the rule never matches (example from https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr-eventbridge.html#ecr-eventbridge-bus):
{
"version": "0",
"id": "13cde686-328b-6117-af20-0e5566167482",
"detail-type": "ECR Image Action",
"source": "aws.ecr",
"account": "123456789012",
"time": "2019-11-16T01:54:34Z",
"region": "us-west-2",
"resources": [], // <--- empty, rule fails
"detail": {
"result": "SUCCESS",
"repository-name": "my-repository-name",
"image-digest": "sha256:7f5b2640fe6fb4f46592dfd3410c4a79dac4f89e4782432e0378abcd1234",
"action-type": "PUSH",
"image-tag": "latest"
}
}
Expected Behavior
Use the detail.repository-name field as a filter instead of resources:
{
"detail": {
"repository-name": ["my-repository-name"]
},
"source": ["aws.ecr"]
}
Current Behavior
Uses resources as a filter, which is empty in the real event
Reproduction Steps
var ecrRepo = new EcrRepository(this, "CiTestEcrRepository", new EcrRepositoryProps());
ecrRepo.OnEvent("EcrRepoEventRule", new OnEventOptions() {
Target = new LambdaFunction(myLambdaHandler),
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.127.0 (build 6c90efc)
Framework Version
.NET 8
Node.js Version
v18.16.1
OS
MacOS
Language
.NET
Language Version
.NET 8
Other information
No response
Describe the bug
Using the CDK, creating an EventBridge rule on an ECR repository creates a rule with the following event pattern:
{ "resources": ["arn:aws:ecr:ap-southeast-2:<account-id>:repository/my-repository-name"], "source": ["aws.ecr"] }However when ECR sends the event,
"resources"is empty, so the rule never matches (example from https://docs.aws.amazon.com/AmazonECR/latest/userguide/ecr-eventbridge.html#ecr-eventbridge-bus):{ "version": "0", "id": "13cde686-328b-6117-af20-0e5566167482", "detail-type": "ECR Image Action", "source": "aws.ecr", "account": "123456789012", "time": "2019-11-16T01:54:34Z", "region": "us-west-2", "resources": [], // <--- empty, rule fails "detail": { "result": "SUCCESS", "repository-name": "my-repository-name", "image-digest": "sha256:7f5b2640fe6fb4f46592dfd3410c4a79dac4f89e4782432e0378abcd1234", "action-type": "PUSH", "image-tag": "latest" } }Expected Behavior
Use the
detail.repository-namefield as a filter instead ofresources:{ "detail": { "repository-name": ["my-repository-name"] }, "source": ["aws.ecr"] }Current Behavior
Uses
resourcesas a filter, which is empty in the real eventReproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.127.0 (build 6c90efc)
Framework Version
.NET 8
Node.js Version
v18.16.1
OS
MacOS
Language
.NET
Language Version
.NET 8
Other information
No response