首页 > 解决方案 > 为什么 Inspec 在检查 aws_elbs 端口时返回“expected [] to include”?

问题描述

这是一个检查特定网络负载均衡器的 VPC-Id、端口、子网和可用区的 Inspec 控件:

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

执行时,测试失败,我得到

预计 [] 将包括“vpc-a12345678”

预计 [] 包括 443

预计 [] 将包括“subnet-12345678”

预计 [] 将包括“eu-central-1a”

我仔细检查了负载均衡器的 ARN,但我总是得到这个空的结果数组。

标签: rubyamazon-web-serviceschef-infrainspec

解决方案


我现在很确定会发生这种情况,因为Inspec 不支持 Network Load Balancers。如果有人遇到同样的问题,将把它留在这里。


推荐阅读