-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(aws-events): EventPattern support for wildcard filters #28462
Comments
What error message was that? Can you share the synthesized output specifically for the |
Have you tried using the Match class? https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.Match.html This came up in a similar issue earlier this year: #25424 |
@pahud this is synthesized output: {
"EventPattern": {
"source": [
"aws.states"
],
"detail-type": [
"Step Functions Execution Status Change"
],
"resources": [
{
"Fn::Join": [
"",
[
"{ \"wildcard\": \"arn:",
{
"Ref": "AWS::Partition"
},
":states:",
{
"Ref": "AWS::Region"
},
":",
{
"Ref": "AWS::AccountId"
},
":execution:xxx:yyy*\" }"
]
]
}
]
}
} |
@tim-finnigan Yes, I had try it. But there is no event pattern matcher can support for wildcard filter. |
Yes it can deploy and I see this from the console {
"detail-type": ["Step Functions Execution Status Change"],
"resources": ["{ \"wildcard\": \"arn:aws:states:us-west-2:903779448426:execution:xxx:yyy*\" }"],
"source": ["aws.states"]
} while this is expected: {
"detail-type": ["Step Functions Execution Status Change"],
"resources": [{
"wildcard": "arn:aws:states:us-east-1:111122223333:execution:xxx:yyy*"
}],
"source": ["aws.states"]
} I guess the Match would need to support const ruleState = new events.Rule(this, 'ListenStateStatusChange', {
description: 'Rule for listen SFN state machine status change',
eventPattern: {
source: ['aws.states'],
detailType: ['Step Functions Execution Status Change'],
resources: [`{ "wildcard": "arn:${Aws.PARTITION}:states:${Aws.REGION}:${Aws.ACCOUNT_ID}:execution:xxx:yyy*" }`],
},
});
(ruleState.node.defaultChild as events.CfnRule).addPropertyOverride('EventPattern.resources.0',
{ wildcard: `arn:${Aws.PARTITION}:states:${Aws.REGION}:${Aws.ACCOUNT_ID}:execution:xxx:yyy*` },
); Let me know if it works for you. |
@pahud Thank you for your prompt. I have successfully created the rule following code: const cfnRule = rule.node.defaultChild as events.CfnRule;
cfnRule.addOverride('Properties.EventPattern.resources', [
{wildcard: `arn:${Aws.PARTITION}:states:${Aws.REGION}:${Aws.ACCOUNT_ID}:execution:xxx:yyy*`},
]); |
@tyyzqmf Awesome! I am leaving this issue open until we have better implementation in CDK. |
encountered this issue too |
Comments on closed issues and PRs are hard for our team to see. |
1 similar comment
Comments on closed issues and PRs are hard for our team to see. |
Describe the feature
As this whats-new: Amazon EventBridge announces support for wildcard filters in rules
Use Case
We can set event pattern in web console:
But can not create this rule by CDK:
Proposed Solution
No response
Other Information
No response
Acknowledgements
CDK version used
2.81.0
Environment details (OS name and version, etc.)
linux
The text was updated successfully, but these errors were encountered: