Skip to main content

aws_elasticloadbalancingv2_listeners Resource

Use the aws_elasticloadbalancingv2_listeners InSpec audit resource to test the properties of multiple Application Load Balancer or Network Load Balancer listeners.

For additional information, including details on parameters and properties, see the AWS documentation on ElasticLoadBalancingV2 Listener.

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

An aws_elasticloadbalancingv2_listeners resource block returns all Application Load Balancer or Network Load Balancer listeners.

describe aws_elasticloadbalancingv2_listener(load_balancer_arn: "LOAD_BALANCER_ARN") do
  its { should exist }
end

Parameters

load_balancer_arn (required)

The Amazon Resource Name (ARN) of the load balancer.

Properties

listener_arns
The Amazon Resource Name (ARN) of the listener.
load_balancer_arns
The Amazon Resource Name (ARN) of the load balancer.
ports
The port on which the load balancer is listening.
protocols
The protocol for connections from clients to the load balancer.
certificates
The certificates of the listener.
ssl_policies
The SSL policies of the listener.
default_actions
The default actions of the listener.
alpn_policies
The name of the Application-Layer Protocol Negotiation (ALPN) policies of the listener.

Examples

Ensure there are ports attached to the listener.

describe aws_elasticloadbalancingv2_listener(load_balancer_arn: "LOAD_BALANCER_ARN") do
    its('ports') { should include PORT_NUMBER}
end

Matchers

For a full list of available matchers, visit the InSpec matchers page.

exist

The control will pass if the describe returns at least one result.

Use should_not to test the entity should not exist.

describe aws_elasticloadbalancingv2_listener(load_balancer_arn: "LOAD_BALANCER_ARN") do
  it { should_not exist }
end

AWS Permissions

Your Principal will need the ElasticLoadBalancingV2:Client:DescribeListenersOutput action with Effect set to Allow.

You can find detailed documentation at Actions, Resources, and Condition Keys for Amazon Auto Scaling Groups.

Edit this page on GitHub

Thank you for your feedback!

×