The cloudformation for event pattern generated by cdk contains 'detailType' while it should generate the key as 'detail-type'
See original GitHub issueDescription of the bug: When i use Cdk the cloudformation template that is generated for the 'event pattern ’ in a CfnRule construct contains the key as ‘detailType’ rather than ‘detail-type’
Reproduction Steps
Use the following in a Cdk stack
const cbEventPattern :EventPattern ={
source: [
'aws.codebuild'
],
detail: {
'build-status': [
'FAILED'
],
'project-name':' some value'
},
detailType: [
'CodeBuild Build State Change'
],
}
const codeBuildRule = new CfnRule(this, 'CodeBuildCloudWatchEventsRule', {
description: 'Code Build cloudwatch events rule',
eventPattern: cbEventPattern,
name: '',
state: 'ENABLED'
})
Error Log
Environment
- CLI Version : 1.20.0
- Framework Version:0.22
- OS :Windows
- Language :typescript
Other
I found the following link https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-events/lib/rule.ts#L348 although i see a solve is there it does not work.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
interface EventPattern · AWS CDK
In a CfnRule class, write the pattern as you normally would when directly writing CloudFormation. ... Represents the "detail-type" event field.
Read more >AWS Lambda Events - Event Bridge - Serverless Framework
EventBridge Event. The EventBridge makes it possible to connect applications using data from external sources (e.g. own applications, SaaS) or AWS services.
Read more >Connecting Event Busses Across AWS Accounts | Ben's Blog
Select your bus then click Actions→Send events. Selecting an event bus. On the page that opens, make sure the "Detail type" matches the...
Read more >Automate Documenting API Gateways in EventCatalog
new Rule(this, `cfRule`, { eventBus: props.bus, eventPattern: { source: ["aws.cloudformation"], detailType: ["CloudFormation Stack Status Change ...
Read more >EventBridge rule "anything-but" pattern - Stack Overflow
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html. "For an event pattern to match an event, the event must ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rix0rrr the docs for https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-events.CfnRule.html#eventpattern-1 are incredibly confusing:
This is confusing but it gives the impression that it expects an EventPattern. The EventPattern docs helpfully clarify this is not the case, but the docs for CfnRule are quite confusing. EventPattern trying to correct the situation:
I resolved this problem by passing a raw dictionary, rather than an EventPattern, given that
event_pattern
attribute can beAny
: