Skip to main content

aws_eventbridge_rule Resource

Use the aws_eventbridge_rule InSpec audit resource to test properties of a single Amazon EventBridge event rule.

The AWS::Events::Rule resource creates a rule that matches incoming events and routes them to one or more targets for processing.

For additional information, including details on parameters and properties, see the AWS documentation on Events Rule.

Install

This resource is available in the Chef InSpec AWS resource pack.

For information on configuring your AWS environment for Chef InSpec and creating an InSpec profile that uses the InSpec AWS resource pack, see the Chef InSpec documentation on the AWS cloud platform.

Syntax

Ensure that a rule name exists.

describe aws_eventbridge_rule(name: 'test_rule') do
  it { should exist }
end

Parameters

name (required)

The name of the rule. Pass the name as a key-value entry in a hash.

Properties

name
The name of the rule.
arn
The Amazon Resource Name (ARN) of the rule.
event_pattern
The event pattern.
schedule_expression
The scheduling expression. For example, “cron(0 20 * * ? *)”, “rate(5 minutes)”.
state
Specifies whether the rule is enabled or disabled.
description
The description of the rule.
role_arn
The Amazon Resource Name (ARN) of the IAM role associated with the rule.
managed_by
If this is a managed rule, created by an AWS service on your behalf, this field displays the principal name of the AWS service that created the rule.
event_bus_name
The name of the event bus associated with the rule.

Examples

Ensure a rule name is available.

describe aws_eventbridge_rule(name: 'RULE_NAME') do
  its('name') { should eq 'RULE_NAME' }
end

Ensure that the state is ENABLED or DISABLED.

describe aws_eventbridge_rule(name: 'RULE_NAME') do
    its('state') { should eq 'ENABLED' }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

The controls will pass if the describe method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_eventbridge_rule(name: 'test_rule') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_eventbridge_rule(name: 'dummy') do
  it { should_not exist }
end

be_available

Use should to check if the work_group name is available.

describe aws_eventbridge_rule(name: 'test_rule') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the EventBridge:Client:DescribeRuleResponse action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×