inspec/test/integration/aws/default/verify/controls/aws_vpc.rb
Clinton Wolfe 745ff32c80 Basic fields for aws_vpcs (#2930)
* Update singular implementation to avoid use of inner object
* Update docs and tests for 3 new filters and properties on aws_vpcs
* Implement new filters and properties; one failing test due to odd FilterTable behavior
* changes to avoid bug 2929

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2018-04-12 15:48:55 -04:00

62 lines
1.5 KiB
Ruby

fixtures = {}
[
'vpc_default_vpc_id',
'vpc_default_cidr_block',
'vpc_default_dhcp_options_id',
'vpc_non_default_id',
'vpc_non_default_cidr_block',
'vpc_non_default_instance_tenancy',
'vpc_non_default_dhcp_options_id',
].each do |fixture_name|
fixtures[fixture_name] = attribute(
fixture_name,
default: "default.#{fixture_name}",
description: 'See ../build/ec2.tf',
)
end
control "aws_vpc recall" do
describe aws_vpc(fixtures['vpc_default_vpc_id']) do
it { should exist}
end
describe aws_vpc do
it { should exist }
end
describe aws_vpc(vpc_id: fixtures['vpc_non_default_id']) do
it { should exist }
end
describe aws_vpc('vpc-12345678') do
it { should_not exist }
end
end
control "aws_vpc properties" do
describe aws_vpc(fixtures['vpc_non_default_id']) do
its('vpc_id') { should eq fixtures['vpc_non_default_id'] }
its('state') { should eq 'available' }
its('cidr_block') { should eq fixtures['vpc_non_default_cidr_block']}
its('instance_tenancy') { should eq fixtures['vpc_non_default_instance_tenancy']}
its('dhcp_options_id') { should eq fixtures['vpc_non_default_dhcp_options_id']}
end
describe aws_vpc do
its('vpc_id') { should eq fixtures['vpc_default_vpc_id'] }
end
end
control "aws_vpc matchers" do
describe aws_vpc do
it { should be_default }
end
describe aws_vpc(fixtures['vpc_default_vpc_id']) do
it { should be_default }
end
describe aws_vpc(fixtures['vpc_non_default_id']) do
it { should_not be_default }
end
end