This is an Inspec control that checks for the VPC-Id, Ports, Subnets and AZs for a specific Network Loadbalancer:
control 'Loadbalancer Config' do
title 'Checks for correct configuration of LBs'
describe aws_elbs.where(arn: 'arn:aws:elasticloadbalancing:eu-central-1:123456789:loadbalancer/app/web-app-alb/1d234567890d') do
its('vpc_ids') { should include 'vpc-a12345678' }
its('subnet_ids') { should include 'subnet-12345678' }
its('internal_ports') { should include 443 }
its('availability_zones') { should include 'eu-central-1a' }
end
end
When executing, the tests fail and I get
expected [] to include "vpc-a12345678"
expected [] to include 443
expected [] to include "subnet-12345678"
expected [] to include "eu-central-1a"
I double checked the ARN of the Loadbalancer but I always get this empty array of results.