2017-12-14 14:28:29 +00:00
|
|
|
fixtures = {}
|
|
|
|
[
|
|
|
|
'ec2_security_group_default_vpc_id',
|
|
|
|
'ec2_security_group_default_group_id',
|
|
|
|
'ec2_security_group_alpha_group_id',
|
2018-02-01 02:51:43 +00:00
|
|
|
'ec2_security_group_alpha_group_name',
|
2017-12-14 14:28:29 +00:00
|
|
|
].each do |fixture_name|
|
|
|
|
fixtures[fixture_name] = attribute(
|
|
|
|
fixture_name,
|
|
|
|
default: "default.#{fixture_name}",
|
|
|
|
description: 'See ../build/ec2.tf',
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_ec2_security_group recall of default VPC" do
|
|
|
|
|
|
|
|
describe aws_ec2_security_group(fixtures['ec2_security_group_default_group_id']) do
|
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_ec2_security_group(group_name: 'default', vpc_id: fixtures['ec2_security_group_default_vpc_id']) do
|
|
|
|
it { should exist }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_ec2_security_group(group_name: 'no-such-security-group') do
|
|
|
|
it { should_not exist }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
control "aws_ec2_security_group properties" do
|
|
|
|
# You should be able to find the default security group's ID.
|
|
|
|
describe aws_ec2_security_group(fixtures['ec2_security_group_default_group_id']) do
|
|
|
|
its('group_id') { should cmp fixtures['ec2_security_group_default_group_id'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe aws_ec2_security_group(fixtures['ec2_security_group_alpha_group_id']) do
|
2018-02-01 02:51:43 +00:00
|
|
|
its('group_name') { should cmp fixtures['ec2_security_group_alpha_group_name'] }
|
2017-12-14 14:28:29 +00:00
|
|
|
its('vpc_id') { should cmp fixtures['ec2_security_group_default_vpc_id'] }
|
|
|
|
its('description') { should cmp 'SG alpha' }
|
|
|
|
end
|
|
|
|
|
2018-02-01 02:51:43 +00:00
|
|
|
end
|