chef / 17.9.18 / inspec / resources / aws_albs / index.html /

aws_albs resource

[edit on GitHub]

Use the aws_albs InSpec audit resource to test the configuration of a collection of Application Load Balancers.

Syntax

Ensure that an aws_albs exists

describe aws_albs do
  its('load_balancer_arns') { should include 'arn:aws:elasticloadbalancing' }
end

Parameters

This resource does not expect any parameters.

See also the AWS documentation on Elastic Load Balancing.

Properties

Property Description
load_balancer_names The names of the load balancers.
load_balancer_addresses A collection of the load balancers addresses.
canonical_hosted_zone_ids The IDs of the Amazon Route 53 hosted zone for the load balancers.
dns_names The DNS names of the load balancers.
availability_zones The Availability Zones for the load balancers.
security_groups The security groups for the load balancers. Valid only for load balancers in a VPC.
schemes The types of load balancers. Valid only for load balancers in a VPC.
states The states of the load balancers.
subnets A collection of the subnet ids.
types The types of the load balancers.
vpc_ids The IDs of the VPCs for the load balancers.
zone_names A collection of the names of the availability zones.

Examples

Test that an ALB has its availability zones configured correctly

describe aws_alb('arn::alb') do
  its('zone_names.count')  { should be > 1 }
  its('zone_names')        { should include 'us-east-2a' }
  its('zone_names')        { should include 'us-east-2b' }
end

Matchers

This InSpec audit resource has no special matchers. For a full list of available matchers, please visit our Universal 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_albs do
  it                             { should exist }
  its('availability_zones')      { should_not include 'us-east-1a'}
end

AWS Permissions

Your Principal will need the elasticloadbalancing:DescribeLoadBalancers action set to Allow.

You can find detailed documentation at Authentication and Access Control for Your Load Balancers

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/aws_albs/