Skip to main content

aws_ec2_egress_only_internet_gateway Resource

Use the aws_ec2_egress_only_internet_gateway InSpec audit resource to test properties of a single specific AWS EC2 egress-only internet gateway.

The AWS::EC2::EgressOnlyInternetGateway specifies an egress-only internet gateway for your VPC.

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 the egress-only internet gateway Id exists.

describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
  it { should exist }
end

Parameters

egress_only_internet_gateway_id (required)

The ID of the egress-only internet gateway.

For additional information, see the AWS documentation on AWS EC2 egress-only internet gateway..

Properties

attachments
Information about the attachment of the egress-only internet gateway.
attachments_states
The current state of the attachment.
attachments_vpc_ids
The ID of the VPC.
egress_only_internet_gateway_id
The ID of the egress-only internet gateway.
tags
The tags assigned to the egress-only internet gateway.

Examples

Ensure an egress-only internet gateway ID is available.

describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
  its('egress_only_internet_gateway_id') { should eq 'EGRESS_ONLY_INTERNET_GATEWAY_ID' }
end

Ensure that the attachments states is attached.

describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
    its('attachments_states') { should eq 'attached' }
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_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_ec2_egress_only_internet_gateway(egress_only_internet_gateway_id: 'EGRESS_ONLY_INTERNET_GATEWAY_ID') do
  it { should be_available }
end

AWS Permissions

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

Edit this page on GitHub

Thank you for your feedback!

×









Search Results