Skip to main content

aws_cloudtrail_trails Resource

Use the aws_cloudtrail_trails InSpec audit resource to test properties of a collection of AWS CloudTrail Trails.

For additional information, including details on parameters and properties, see the AWS documentation on Auto Scaling Group.

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

An aws_cloudtrail_trails resource block returns all CloudTrail Trails and allows the testing of those trails.

describe aws_cloudtrail_trails do
  it { should exist }
end

Parameters

This resource does not require any parameters.

Properties

trail_arns
Specifies the ARNs of the trails.
names
The names of the trails.
entries
Provides access to the raw results of the query, which can be treated as an array of hashes.

Examples

Ensure a CloudTrail with a specific name exists.

describe aws_cloudtrail_trails do
  its('names') { should include('trail-1') }
end

Ensure a CloudTrail with a specific arn exists.

describe aws_cloudtrail_trails do
  its('trail_arns') { should include('arn:aws:cloudtrail:us-east-1::trail/trail-1') }
end

Matchers

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

This resource has the following special matchers.

exist

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

Use should_not to test the entity should not exist.

describe aws_cloudtrail_trails do
  it { should exist }
end
describe aws_cloudtrail_trails do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the CloudTrail:Client:DescribeTrailsResponse action with Effect set to Allow.

You can find detailed documentation at Actions, Resources, and Condition Keys for AWS CloudTrail.

Edit this page on GitHub

Thank you for your feedback!

×











Search Results