Skip to main content

aws_ec2_prefix_lists Resource

Use the aws_ec2_prefix_lists InSpec audit resource to test properties of multiple AWS EC2 prefix lists.

The AWS::EC2::PrefixList resource specifies a managed prefix list.

For additional information, including details on parameters and properties, see the AWS documentation on AWS EC2 prefix lists.

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 prefix list exists.

describe aws_ec2_prefix_lists do
  it { should exist }
end

Parameters

This resource does not require any parameters.

Properties

prefix_list_ids
prefix_list_id.
address_families
address_family.
states
state.
state_messages
state_message.
prefix_list_arns
prefix_list_arn.
prefix_list_names
prefix_list_name.
max_entries
max_entries.
versions
version.
tags
tags.
owner_ids
owner_id.

Examples

Ensure a prefix list ID is available.

describe aws_ec2_prefix_lists do
  its('prefix_list_ids') { should include 'PREFIX_LIST_ID' }
end

Ensure an address family is available.

describe aws_ec2_prefix_lists do
  its('address_families') { should include 'ADDRESS_FAMILY' }
end

Ensure that the state is AVAILABLE.

describe aws_ec2_prefix_lists do
    its('states') { should include 'AVAILABLE' }
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_ec2_prefix_lists do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_prefix_lists do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the EC2:Client:DescribeManagedPrefixListsResult action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×