Skip to main content

aws_ec2_client_vpn_route Resource

[edit on GitHub]

Use the aws_ec2_client_vpn_route InSpec audit resource to test properties of a single specific AWS EC2 Client VPN route.

The AWS::EC2::ClientVpnRoute specifies a network route to add to a Client VPN endpoint.

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

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 client VPN endpoint exists.

describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
  it { should exist }
end

Parameters

client_vpn_endpoint_id (required)

The ID of the Client VPN endpoint with which the route is associated.

target_subnet (required)

The ID of the subnet through which traffic is routed.

Properties

client_vpn_endpoint_id
The ID of the Client VPN endpoint with which the route is associated.

Field: carrier_gateway_id

destination_cidr
The IPv4 address range, in CIDR notation, of the route destination.

Field: carrier_gateway_id

target_subnet
The ID of the subnet through which traffic is routed.

Field: carrier_gateway_id

type
The route type.

Field: carrier_gateway_id

origin
Indicates how the route was associated with the Client VPN endpoint. associate indicates that the route was automatically added when the target network was associated with the Client VPN endpoint.

Field: carrier_gateway_id

status.code
The state of the Client VPN endpoint route.

Field: carrier_gateway_id

status.message
A message about the status of the Client VPN endpoint route, if applicable.

Field: carrier_gateway_id

description
A brief description of the route.

Field: carrier_gateway_id

Examples

Ensure a client VPN endpoint ID is available.

describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
  its('client_vpn_endpoint_id') { should eq 'CLIENT_VPN_ENDPOINT_ID' }
end

Ensure that the status code is active.

describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
    its('status.code') { should eq 'active' }
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_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_ec2_client_vpn_route(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID", target_subnet: "TARGET_SUBNET") do
  it { should be_available }
end

AWS Permissions

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

Was this page helpful?

×









Search Results