Skip to content
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

Received ''null' values are not allowed in templates'' while creating AWS::Events::Rule -> EventPattern #1378

Open
rohan-1995 opened this issue Oct 26, 2022 · 3 comments
Labels

Comments

@rohan-1995
Copy link

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

@rohan-1995 rohan-1995 added the bug label Oct 26, 2022
@nmeisen nmeisen changed the title Received ''null' values are not allowed in templates'' while creating AWS::Events::Rule-> EventPattern Received ''null' values are not allowed in templates'' while creating AWS::Events::Rule -> EventPattern Mar 18, 2024
@minne6
Copy link

minne6 commented May 6, 2024

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

@slootjes
Copy link

Almost 2 years later, this is still an issue.

@slootjes
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: We're working on it
Development

No branches or pull requests

3 participants