Skip to main content

aws_vpn_connections Resource

Use the aws_vpn_connections InSpec audit resource to test the properties of all AWS VPN connections.

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

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 one or more VPN connections exist.

describe aws_vpn_connections do
  it { should exist }
end

Parameters

This resource does not require any parameters.

Properties

vpn_connection_ids
This property provides all the IDs of the VPN connections.
vpn_gateway_ids
This property provides all the IDs of the virtual private gateways associated with the VPN connections.
outside_ip_addresses
This property provides the outside IP addresses of the VPN connections.
tunnel_inside_cidrs
This property provides the tunnel inside CIDRs of the VPN connections.
states
This property provides the current state of the VPN connections.
types
This property provides the current types of VPN connections.
tags
This property provides the current tags of the VPN connections.

Examples

Ensure that VPN connections are available

describe aws_vpn_connections do
  its('state.uniq') { should eq ['available'] }
end

To check tags

describe aws_vpn_connections.where { tags["Name"] == "vpn-connection-example-123" } do
  it { should exist }
  its('count') { should be 3 }
end

Matchers

For a full list of available matchers, see our Universal Matchers page.

This resource has the following special matchers.

exist

The control passes if the describe returns at least one result.

describe aws_vpn_connections do
  it { should exist }
end

not exists

Use should_not to test whether the entity should not exist.

describe aws_vpn_connections do
  it { should_not exist }
end

AWS Permissions

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

You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon EC2.

Edit this page on GitHub

Thank you for your feedback!

×