Skip to main content

aws_ec2_network_interface_attachments Resource

Use the aws_ec2_network_interface_attachments InSpec audit resource to test properties of multiple AWS EC2 network interface attachments.

The AWS::EC2::NetworkInterfaceAttachment resource attaches an elastic network interface (ENI) to an Amazon EC2 instance. You can use this resource type to attach additional network interfaces to an instance without interruption.

For additional information, including details on parameters and properties, see the AWS documentation on AWS Lambda Function.

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 network interface attachment exists.

describe aws_ec2_network_interface_attachments do
  it { should exist }
end

Parameters

This resource does not require any parameters.

Properties

attach_times
The timestamp indicating when the attachment initiated.

Field: attach_time

attachment_ids
The ID of the network interface attachment.

Field: attachment_id

delete_on_terminations
Indicates whether the network interface is deleted when the instance is terminated.

Field: delete_on_termination

device_indexes
The device index of the network interface attachment on the instance.

Field: device_index

network_card_indexes
The index of the network card.

Field: network_card_index

instance_ids
The ID of the instance.

Field: instance_id

instance_owner_ids
The Amazon Web Services account ID of the owner of the instance.

Field: instance_owner_id

statuses
The attachment state.

Field: status

Examples

Ensure an attachment ID is available.

describe aws_ec2_network_interface_attachment(network_interface_id: 'NETWORK_INTERFACE_ID') do
  its('attachment_ids') { should include 'ATTACHMENT_ID' }
end

Ensure that a network interface status is available.

describe aws_ec2_network_interface_attachment(network_interface_id: 'NETWORK_INTERFACE_ID') do
    its('statuses') { 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_network_interface_attachments do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_network_interface_attachments do
  it { should_not exist }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results