aws_ec2_egress_only_internet_gateways Resource
Use the aws_ec2_egress_only_internet_gateways
InSpec audit resource to test properties of multiple AWS EC2 egress-only internet gateways.
The AWS::EC2::EgressOnlyInternetGateway
specifies an egress-only internet gateway for your VPC.
Installation
This resource is available in the Chef InSpec AWS resource pack.
See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.
Syntax
Ensure that the egress-only internet gateway Id exists.
describe aws_ec2_egress_only_internet_gateways do
it { should exist }
end
Parameters
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.
Field:
attachments
attachments_states
- The current state of the attachment.
Field:
state
attachments_vpc_ids
- The ID of the VPC.
Field:
vpc_id
egress_only_internet_gateway_id
- The ID of the egress-only internet gateway.
Field:
egress_only_internet_gateway_id
tags
- The tags assigned to the egress-only internet gateway.
Field:
tags
Examples
Ensure an egress-only internet gateway ID is available.
describe aws_ec2_egress_only_internet_gateways do
its('egress_only_internet_gateway_ids') { should include 'EgressOnlyInternetGatewayId' }
end
Ensure that the attachments states is attached
.
describe aws_ec2_egress_only_internet_gateways do
its('attachments_states') { should include 'attached' }
end
Matchers
This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit 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_gateways do
it { should exist }
end
Use should_not
to test that an entity does not exist.
describe aws_ec2_egress_only_internet_gateways do
it { should_not exist }
end
be_available
Use should
to check if the entity is available.
describe aws_ec2_egress_only_internet_gateways do
it { should be_available }
end
AWS Permissions
Your Principal will need the EC2:Client:DescribeEgressOnlyInternetGatewaysResult
action with Effect
set to Allow
.