Skip to main content

aws_ec2_carrier_gateway Resource

Use the aws_ec2_carrier_gateway InSpec audit resource to test properties of a specific AWS EC2 carrier gateway.

The AWS::EC2::CarrierGateway resource creates a carrier gateway.

carrier_gateway_id (required)

The ID of the carrier gateway.

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

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 carrier gateway exists.

describe aws_ec2_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
  it { should exist }
end

Parameters

carrier_gateway_id (required)

The ID of the carrier gateway.

Properties

carrier_gateway_id
The ID of the carrier gateway.
vpc_id
The ID of the VPC (Virtual Private Cloud) associated with the carrier gateway.
state
The state of the carrier gateway.
owner_id
The Amazon Web Services account ID of the owner of the carrier gateway.
tags
The tags assigned to the carrier gateway.

Examples

Ensure a carrier gateway ID is available.

describe aws_ec2_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
  its('carrier_gateway_id') { should eq 'GATEWAY_ID' }
end

Ensure that the state is available.

describe aws_ec2_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
    its('state') { should eq 'available' }
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_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_ec2_carrier_gateway(carrier_gateway_id: "GATEWAY_ID") do
  it { should be_available }
end

AWS Permissions

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

Edit this page on GitHub.

Thank you for your feedback!

×









Search Results