inspec/test/integration/verify/controls/aws.rb
Miles 69434fec48 Use terraform environments to avoid integration test collisions
* When running integration tests with Rakefile use terraform environment based on environment variable INSPEC_TERRAFORM_ENV
** If INSPEC_TERRAFORM_ENV is not provided, a random string will be used
* Use terraform environment as a namespace for AWS artifacts
* Use attribute file for inspec to be aware of the terraform environment used

Signed-off-by: Miles Tjandrawidjaja <miles@tjandrawidjaja.com>
2017-05-06 14:14:53 -04:00

26 lines
772 B
Ruby

example_ec2_id = attribute(
'example_ec2_id',
default: 'default.example_ec2_id',
description: 'ID of example ec2 instance')
example_ec2_name = attribute(
'example_ec2_name',
default: 'default.Example',
description: 'Name of exapmle ec2 instance')
describe aws_ec2(name: example_ec2_name) do
it { should exist }
its('image_id') { should eq 'ami-0d729a60' }
its('instance_type') { should eq 't2.micro' }
end
describe aws_ec2(example_ec2_id) do
it { should exist }
its('image_id') { should eq 'ami-0d729a60' }
its('instance_type') { should eq 't2.micro' }
end
#must use a real EC2 instance name, as the SDK will first check to see if its well formed before sending requests
describe aws_ec2('i-06b4bc106e0d03dfd') do
it { should_not exist }
end