Open rohan-1995 opened 1 year ago
Hi, Do you have any solution for this problem? Is this fixed? I am unable to use null check in eventbridge pattern using yaml cloudformation template. @rohan-1995
Almost 2 years later, this is still an issue.
My colleague had a brilliant hacky idea and it seems to work. Since the property EventPattern is a JSON type, it also supports a stringified JSON object, where null values are allowed.
YourRule:
Type: AWS::Events::Rule
Properties:
EventPattern: '{
"detail": {
"responseElements": [null]
}
}'
It doesn't look pretty but it does the trick :)
Name of the resource
AWS::Events::Rule
Resource Name
No response
Issue Description
EventPattern accepts Null value as per EventBridge service [1] ,even CDK documentation [2] mention that EventPattern can have null values. However CloudFormation service does not accept Null value when defined for EventPattern. Template fails in validation with following error - 'null' values are not allowed in templates
[1] https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-null-values.html [2] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventPattern.html
Expected Behavior
AWS::Events::Rule should accept null values for 'EventPattern' property
Observed Behavior
template does not pass validation and throws error - 'null' values are not allowed in templates
Test Cases
Create EventBridge rule with EventPattern having null value in CFN template
Other Details
No response