I defined some basic Inspec tests to check if a loadbalancer is active:
proxy = attribute('proxy_netlb_arn')
control 'Checks if all the ECE Load balancers are active ' do
impact 1.0
title 'Checks if all the ECE Load balancers are active'
describe command("aws elbv2 describe-load-balancers --load-balancer-arn proxy['value'] | jq -r '.[][].State.Code'") do
its('stdout') { should match "active" }
end
end
I use a variable called "proxy" which contains the ARN of the Loadbalancer. Unfortunately the variable is not recognized as such because it is inside the command.