2017-04-29 23:46:53 +00:00
|
|
|
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',
|
2017-10-26 19:56:32 +00:00
|
|
|
description: 'Name of example ec2 instance')
|
|
|
|
|
|
|
|
no_roles_ec2_id = attribute(
|
|
|
|
'no_roles_ec2_id',
|
|
|
|
default: 'default.no_roles_ec2_id',
|
|
|
|
description: 'ID of no-roles ec2 instance')
|
2017-04-29 23:46:53 +00:00
|
|
|
|
2017-10-11 20:18:20 +00:00
|
|
|
describe aws_ec2_instance(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_instance(example_ec2_id) do
|
|
|
|
it { should exist }
|
|
|
|
its('image_id') { should eq 'ami-0d729a60' }
|
|
|
|
its('instance_type') { should eq 't2.micro' }
|
2017-10-26 19:56:32 +00:00
|
|
|
it { should have_roles }
|
2017-10-11 20:18:20 +00:00
|
|
|
end
|
|
|
|
|
2017-10-26 19:56:32 +00:00
|
|
|
describe aws_ec2_instance(no_roles_ec2_id) do
|
2017-02-06 12:06:01 +00:00
|
|
|
it { should exist }
|
2017-10-26 19:56:32 +00:00
|
|
|
it { should_not have_roles }
|
2017-01-16 15:14:24 +00:00
|
|
|
end
|
2017-02-06 12:06:01 +00:00
|
|
|
|
2017-10-26 19:56:32 +00:00
|
|
|
# must use a real EC2 instance name, as the SDK will first check to see if it's well formed before sending requests
|
2017-10-11 20:18:20 +00:00
|
|
|
describe aws_ec2_instance('i-06b4bc106e0d03dfd') do
|
2017-02-06 12:06:01 +00:00
|
|
|
it { should_not exist }
|
|
|
|
end
|