Skip to main content

aws_ec2_client_vpn_target_network_associations Resource

[edit on GitHub]

Use the aws_ec2_client_vpn_target_network_associations InSpec audit resource to test properties of multiple AWS EC2 Client VPN target network associations.

The AWS::EC2::ClientVpnTargetNetworkAssociation specifies a target network to associate with a Client VPN endpoint.

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

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 target network association exists.

describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
  it { should exist }
end

Parameters

client_vpn_endpoint_id (required)

The ID of the Client VPN endpoint.

Properties

association_ids
The ID of the association.

Field: association_id

vpc_ids
The ID of the VPC in which the target network (subnet) is located.

Field: vpc_id

target_network_ids
The ID of the subnet specified as the target network.

Field: target_network_id

client_vpn_endpoint_ids
The ID of the Client VPN endpoint with which the target network is associated.

Field: client_vpn_endpoint_id

status_codes
The state of the target network association.

Field: status.code

status_messages
A message about the status of the target network association, if applicable.

Field: status.message

security_groups
The IDs of the security groups applied to the target network association.

Field: security_groups

Examples

Ensure an association exists.

describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
  its('association_ids') { should include 'ASSOCIATION_ID' }
end

Ensure that the status code is active.

describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
    its('status_code') { should include '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_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_ec2_client_vpn_target_network_associations(client_vpn_endpoint_id: "CLIENT_VPN_ENDPOINT_ID") do
  it { should be_available }
end

AWS Permissions

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

Was this page helpful?

×









Search Results