Skip to main content

aws_ec2_vpn_connection_routes Resource

[edit on GitHub]

Use the aws_ec2_vpn_connection_routes InSpec audit resource to test properties of multiple AWS EC2 VPN connection routes.

The AWS::EC2::VPNConnectionRoute resource specifies a static route for a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway.

For additional information, including details on parameters and properties, see the AWS documentation on AWS EC2 VPN Connection Route..

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 VPN Connection ID exists.

describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPN_CONNECTION_ID') do
  it { should exist }
end

Parameters

vpn_connection_id (required)

The ID of the VPN Connection.

Properties

destination_cidr_blocks
The CIDR block associated with the local subnet of the customer data center.

Field: destination_cidr_block

sources
Indicates how the routes were provided.

Field: source

states
The current state of the static route.

Field: state

Examples

Ensure a destination CIDR block is available.

describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPN_CONNECTION_ID') do
  its('destination_cidr_blocks') { should eq [['CIDR_BLOCK']] }
end

Ensure that a VPN connection route is available.

describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPN_CONNECTION_ID') do
    its('states') { 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_vpn_connection_routes(vpn_connection_id: 'VPN_CONNECTION_ID') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_vpn_connection_routes(vpn_connection_id: 'VPN_CONNECTION_ID') do
  it { should_not exist }
end

AWS Permissions

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

Was this page helpful?

×









Search Results