2018-04-12 19:48:55 +00:00
|
|
|
fixtures = {}
|
|
|
|
[
|
|
|
|
'vpc_default_vpc_id',
|
|
|
|
'vpc_default_cidr_block',
|
|
|
|
'vpc_default_dhcp_options_id',
|
2018-04-17 15:42:36 +00:00
|
|
|
'vpc_non_default_vpc_id',
|
2018-04-12 19:48:55 +00:00
|
|
|
'vpc_non_default_cidr_block',
|
|
|
|
'vpc_non_default_instance_tenancy',
|
|
|
|
'vpc_non_default_dhcp_options_id',
|
|
|
|
].each do |fixture_name|
|
2019-06-10 21:41:23 +00:00
|
|
|
fixtures[fixture_name] = input(
|
2018-04-12 19:48:55 +00:00
|
|
|
fixture_name,
|
|
|
|
default: "default.#{fixture_name}",
|
|
|
|
description: 'See ../build/ec2.tf',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2018-01-18 15:51:06 +00:00
|
|
|
control "aws_vpcs recall" do
|
|
|
|
describe aws_vpcs do
|
|
|
|
it { should exist }
|
2018-04-12 19:48:55 +00:00
|
|
|
its('vpc_ids') { should include fixtures['vpc_default_vpc_id'] }
|
|
|
|
its('vpc_ids') { should include fixtures['vpc_non_default_vpc_id'] }
|
|
|
|
its('entries.count') { should cmp 2 }
|
2018-01-18 15:51:06 +00:00
|
|
|
end
|
|
|
|
end
|
2018-04-12 19:48:55 +00:00
|
|
|
|
|
|
|
control "aws_vpcs filtering" do
|
2018-04-17 15:42:36 +00:00
|
|
|
describe aws_vpcs.where { cidr_block.start_with? '172'} do
|
|
|
|
its('vpc_ids') { should include fixtures['vpc_non_default_vpc_id'] }
|
2018-04-12 19:48:55 +00:00
|
|
|
end
|
|
|
|
|
2018-04-17 15:42:36 +00:00
|
|
|
describe aws_vpcs.where { dhcp_options_id == fixtures['vpc_default_dhcp_options_id']} do
|
2018-04-12 19:48:55 +00:00
|
|
|
its('vpc_ids') { should include fixtures['vpc_default_vpc_id']}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_vpcs properties" do
|
|
|
|
describe aws_vpcs do
|
|
|
|
its('vpc_ids') { should include fixtures['vpc_default_vpc_id'] }
|
|
|
|
its('vpc_ids') { should include fixtures['vpc_non_default_vpc_id'] }
|
|
|
|
its('cidr_blocks') { should include fixtures['vpc_default_cidr_block']}
|
|
|
|
its('cidr_blocks') { should include fixtures['vpc_non_default_cidr_block']}
|
2018-04-17 15:42:36 +00:00
|
|
|
its('dhcp_options_ids') { should include fixtures['vpc_default_dhcp_options_id']}
|
|
|
|
its('dhcp_options_ids') { should include fixtures['vpc_non_default_dhcp_options_id']}
|
2018-04-12 19:48:55 +00:00
|
|
|
end
|
|
|
|
end
|