2018-02-07 15:03:11 +00:00
|
|
|
fixtures = {}
|
|
|
|
[
|
2018-03-02 18:49:33 +00:00
|
|
|
'subnet_vpc_id',
|
|
|
|
'subnet_01_id',
|
2018-02-26 21:37:36 +00:00
|
|
|
'subnet_01_az',
|
2018-02-07 15:03:11 +00:00
|
|
|
].each do |fixture_name|
|
|
|
|
fixtures[fixture_name] = attribute(
|
|
|
|
fixture_name,
|
|
|
|
default: "default.#{fixture_name}",
|
|
|
|
description: 'See ../build/ec2.tf',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2018-02-08 04:23:05 +00:00
|
|
|
control "aws_subnet recall of subnet_01" do
|
2018-02-07 15:03:11 +00:00
|
|
|
# Test hash given subnet_id
|
2018-03-02 18:49:33 +00:00
|
|
|
describe aws_subnet(subnet_id: fixtures['subnet_01_id']) do
|
2018-02-07 15:03:11 +00:00
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
|
|
|
# Test scalar works
|
2018-03-02 18:49:33 +00:00
|
|
|
describe aws_subnet(fixtures['subnet_01_id']) do
|
2018-02-07 15:03:11 +00:00
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
2018-02-08 04:23:05 +00:00
|
|
|
describe aws_subnet(subnet_id: 'subnet-00000000') do
|
2018-02-07 15:03:11 +00:00
|
|
|
it { should_not exist }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-08 04:23:05 +00:00
|
|
|
control "aws_subnet properties of subnet_01" do
|
2018-03-02 18:49:33 +00:00
|
|
|
describe aws_subnet(subnet_id: fixtures['subnet_01_id']) do
|
|
|
|
its('vpc_id') { should eq fixtures['subnet_vpc_id'] }
|
|
|
|
its('subnet_id') { should eq fixtures['subnet_01_id'] }
|
2018-09-10 18:38:57 +00:00
|
|
|
its('cidr_block') { should eq '172.31.48.0/28' }
|
|
|
|
its('available_ip_address_count') { should eq 11 } # AWS Reserve 5
|
2018-02-26 21:37:36 +00:00
|
|
|
its('availability_zone') { should eq fixtures['subnet_01_az'] }
|
2018-02-07 15:03:11 +00:00
|
|
|
its('ipv_6_cidr_block_association_set') { should eq [] }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-02-08 04:23:05 +00:00
|
|
|
control "aws_subnet matchers of subnet_01" do
|
2018-03-02 18:49:33 +00:00
|
|
|
describe aws_subnet(subnet_id: fixtures['subnet_01_id']) do
|
2018-02-07 15:03:11 +00:00
|
|
|
it { should be_available }
|
|
|
|
it { should_not be_mapping_public_ip_on_launch }
|
|
|
|
it { should_not be_default_for_az }
|
|
|
|
it { should_not be_assigning_ipv_6_address_on_creation }
|
|
|
|
end
|
|
|
|
end
|