Ensure unique security group name while integration testing. (#218)

Signed-off-by: Miah Johnson <miah@chia-pet.org>
This commit is contained in:
Miah Johnson 2018-01-31 18:51:43 -08:00 committed by Clinton Wolfe
parent f09d4f5266
commit 820547aa9d
2 changed files with 8 additions and 3 deletions

View file

@ -189,7 +189,7 @@ output "vpc_non_default_instance_tenancy" {
# Create a security group with a known description
# in the default VPC
resource "aws_security_group" "alpha" {
name = "alpha"
name = "${terraform.env}-alpha"
description = "SG alpha"
vpc_id = "${data.aws_vpc.default.id}"
}
@ -197,3 +197,7 @@ resource "aws_security_group" "alpha" {
output "ec2_security_group_alpha_group_id" {
value = "${aws_security_group.alpha.id}"
}
output "ec2_security_group_alpha_group_name" {
value = "${aws_security_group.alpha.name}"
}

View file

@ -3,6 +3,7 @@ fixtures = {}
'ec2_security_group_default_vpc_id',
'ec2_security_group_default_group_id',
'ec2_security_group_alpha_group_id',
'ec2_security_group_alpha_group_name',
].each do |fixture_name|
fixtures[fixture_name] = attribute(
fixture_name,
@ -33,7 +34,7 @@ control "aws_ec2_security_group properties" do
end
describe aws_ec2_security_group(fixtures['ec2_security_group_alpha_group_id']) do
its('group_name') { should cmp 'alpha' }
its('group_name') { should cmp fixtures['ec2_security_group_alpha_group_name'] }
its('vpc_id') { should cmp fixtures['ec2_security_group_default_vpc_id'] }
its('description') { should cmp 'SG alpha' }
end