2018-01-12 06:51:17 +00:00
|
|
|
fixtures = {}
|
|
|
|
[
|
2018-04-12 19:48:55 +00:00
|
|
|
'vpc_default_vpc_id',
|
|
|
|
'vpc_default_cidr_block',
|
|
|
|
'vpc_default_dhcp_options_id',
|
2018-09-10 18:38:57 +00:00
|
|
|
'vpc_non_default_vpc_id',
|
2018-01-12 06:51:17 +00:00
|
|
|
'vpc_non_default_cidr_block',
|
2018-04-12 19:48:55 +00:00
|
|
|
'vpc_non_default_instance_tenancy',
|
|
|
|
'vpc_non_default_dhcp_options_id',
|
2018-01-12 06:51:17 +00:00
|
|
|
].each do |fixture_name|
|
2019-06-10 21:41:23 +00:00
|
|
|
fixtures[fixture_name] = input(
|
2018-01-12 06:51:17 +00:00
|
|
|
fixture_name,
|
|
|
|
default: "default.#{fixture_name}",
|
|
|
|
description: 'See ../build/ec2.tf',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_vpc recall" do
|
2018-04-12 19:48:55 +00:00
|
|
|
describe aws_vpc(fixtures['vpc_default_vpc_id']) do
|
2018-01-12 06:51:17 +00:00
|
|
|
it { should exist}
|
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_vpc do
|
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
2018-09-10 18:38:57 +00:00
|
|
|
describe aws_vpc(vpc_id: fixtures['vpc_non_default_vpc_id']) do
|
2018-01-12 06:51:17 +00:00
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_vpc('vpc-12345678') do
|
|
|
|
it { should_not exist }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_vpc properties" do
|
2018-09-10 18:38:57 +00:00
|
|
|
describe aws_vpc(fixtures['vpc_non_default_vpc_id']) do
|
|
|
|
its('vpc_id') { should eq fixtures['vpc_non_default_vpc_id'] }
|
2018-01-12 06:51:17 +00:00
|
|
|
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']}
|
2018-04-12 19:48:55 +00:00
|
|
|
its('dhcp_options_id') { should eq fixtures['vpc_non_default_dhcp_options_id']}
|
2018-01-12 06:51:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_vpc do
|
2018-04-12 19:48:55 +00:00
|
|
|
its('vpc_id') { should eq fixtures['vpc_default_vpc_id'] }
|
2018-01-12 06:51:17 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_vpc matchers" do
|
|
|
|
describe aws_vpc do
|
|
|
|
it { should be_default }
|
|
|
|
end
|
|
|
|
|
2018-04-12 19:48:55 +00:00
|
|
|
describe aws_vpc(fixtures['vpc_default_vpc_id']) do
|
2018-01-12 06:51:17 +00:00
|
|
|
it { should be_default }
|
|
|
|
end
|
|
|
|
|
2018-09-10 18:38:57 +00:00
|
|
|
describe aws_vpc(fixtures['vpc_non_default_vpc_id']) do
|
2018-01-12 06:51:17 +00:00
|
|
|
it { should_not be_default }
|
|
|
|
end
|
|
|
|
end
|