chef-provisioning-aws 3.0.4 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +16 -5
- data/Rakefile +15 -6
- data/chef-provisioning-aws.gemspec +17 -17
- data/lib/chef/provider/aws_auto_scaling_group.rb +5 -6
- data/lib/chef/provider/aws_cache_cluster.rb +21 -15
- data/lib/chef/provider/aws_cache_replication_group.rb +12 -8
- data/lib/chef/provider/aws_cache_subnet_group.rb +3 -3
- data/lib/chef/provider/aws_cloudsearch_domain.rb +9 -13
- data/lib/chef/provider/aws_cloudwatch_alarm.rb +10 -12
- data/lib/chef/provider/aws_dhcp_options.rb +18 -21
- data/lib/chef/provider/aws_ebs_volume.rb +24 -26
- data/lib/chef/provider/aws_eip_address.rb +10 -13
- data/lib/chef/provider/aws_elasticsearch_domain.rb +19 -18
- data/lib/chef/provider/aws_iam_instance_profile.rb +5 -7
- data/lib/chef/provider/aws_iam_role.rb +14 -17
- data/lib/chef/provider/aws_image.rb +6 -6
- data/lib/chef/provider/aws_instance.rb +5 -5
- data/lib/chef/provider/aws_internet_gateway.rb +8 -11
- data/lib/chef/provider/aws_key_pair.rb +15 -17
- data/lib/chef/provider/aws_launch_configuration.rb +11 -14
- data/lib/chef/provider/aws_load_balancer.rb +1 -2
- data/lib/chef/provider/aws_nat_gateway.rb +6 -7
- data/lib/chef/provider/aws_network_acl.rb +28 -29
- data/lib/chef/provider/aws_network_interface.rb +25 -27
- data/lib/chef/provider/aws_rds_instance.rb +12 -13
- data/lib/chef/provider/aws_rds_parameter_group.rb +8 -8
- data/lib/chef/provider/aws_rds_subnet_group.rb +8 -9
- data/lib/chef/provider/aws_route_table.rb +19 -20
- data/lib/chef/provider/aws_s3_bucket.rb +22 -25
- data/lib/chef/provider/aws_security_group.rb +268 -285
- data/lib/chef/provider/aws_server_certificate.rb +6 -5
- data/lib/chef/provider/aws_sns_topic.rb +4 -6
- data/lib/chef/provider/aws_sqs_queue.rb +3 -4
- data/lib/chef/provider/aws_subnet.rb +29 -34
- data/lib/chef/provider/aws_vpc.rb +108 -116
- data/lib/chef/provider/aws_vpc_peering_connection.rb +11 -11
- data/lib/chef/provisioning/aws_driver.rb +4 -2
- data/lib/chef/provisioning/aws_driver/aws_provider.rb +234 -241
- data/lib/chef/provisioning/aws_driver/aws_rds_resource.rb +5 -7
- data/lib/chef/provisioning/aws_driver/aws_resource.rb +182 -185
- data/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb +17 -17
- data/lib/chef/provisioning/aws_driver/aws_taggable.rb +13 -15
- data/lib/chef/provisioning/aws_driver/aws_tagger.rb +47 -48
- data/lib/chef/provisioning/aws_driver/credentials.rb +96 -100
- data/lib/chef/provisioning/aws_driver/credentials2.rb +42 -45
- data/lib/chef/provisioning/aws_driver/driver.rb +1349 -1362
- data/lib/chef/provisioning/aws_driver/exceptions.rb +10 -12
- data/lib/chef/provisioning/aws_driver/super_lwrp.rb +60 -60
- data/lib/chef/provisioning/aws_driver/tagging_strategy/auto_scaling.rb +49 -50
- data/lib/chef/provisioning/aws_driver/tagging_strategy/ec2.rb +37 -38
- data/lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb +14 -15
- data/lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb +29 -31
- data/lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb +39 -40
- data/lib/chef/provisioning/aws_driver/tagging_strategy/s3.rb +41 -43
- data/lib/chef/provisioning/aws_driver/version.rb +5 -5
- data/lib/chef/provisioning/driver_init/aws.rb +2 -2
- data/lib/chef/resource/aws_auto_scaling_group.rb +1 -1
- data/lib/chef/resource/aws_cache_cluster.rb +9 -12
- data/lib/chef/resource/aws_cache_replication_group.rb +9 -11
- data/lib/chef/resource/aws_cache_subnet_group.rb +8 -10
- data/lib/chef/resource/aws_cloudsearch_domain.rb +4 -5
- data/lib/chef/resource/aws_cloudwatch_alarm.rb +17 -18
- data/lib/chef/resource/aws_dhcp_options.rb +2 -2
- data/lib/chef/resource/aws_ebs_volume.rb +10 -10
- data/lib/chef/resource/aws_eip_address.rb +5 -5
- data/lib/chef/resource/aws_elasticsearch_domain.rb +4 -4
- data/lib/chef/resource/aws_iam_instance_profile.rb +4 -5
- data/lib/chef/resource/aws_iam_role.rb +2 -3
- data/lib/chef/resource/aws_image.rb +3 -3
- data/lib/chef/resource/aws_instance.rb +4 -4
- data/lib/chef/resource/aws_internet_gateway.rb +3 -3
- data/lib/chef/resource/aws_key_pair.rb +7 -7
- data/lib/chef/resource/aws_launch_configuration.rb +4 -4
- data/lib/chef/resource/aws_load_balancer.rb +7 -7
- data/lib/chef/resource/aws_nat_gateway.rb +11 -11
- data/lib/chef/resource/aws_network_acl.rb +7 -8
- data/lib/chef/resource/aws_network_interface.rb +9 -9
- data/lib/chef/resource/aws_rds_instance.rb +4 -4
- data/lib/chef/resource/aws_rds_parameter_group.rb +3 -3
- data/lib/chef/resource/aws_rds_subnet_group.rb +4 -4
- data/lib/chef/resource/aws_route53_hosted_zone.rb +37 -40
- data/lib/chef/resource/aws_route53_record_set.rb +22 -24
- data/lib/chef/resource/aws_route_table.rb +7 -7
- data/lib/chef/resource/aws_s3_bucket.rb +7 -7
- data/lib/chef/resource/aws_security_group.rb +10 -10
- data/lib/chef/resource/aws_server_certificate.rb +6 -8
- data/lib/chef/resource/aws_sns_topic.rb +2 -2
- data/lib/chef/resource/aws_sqs_queue.rb +5 -7
- data/lib/chef/resource/aws_subnet.rb +9 -9
- data/lib/chef/resource/aws_vpc.rb +11 -11
- data/lib/chef/resource/aws_vpc_peering_connection.rb +4 -4
- data/spec/aws_support.rb +44 -45
- data/spec/aws_support/aws_resource_run_wrapper.rb +2 -2
- data/spec/aws_support/deep_matcher.rb +2 -3
- data/spec/aws_support/deep_matcher/fuzzy_match_objects.rb +6 -9
- data/spec/aws_support/deep_matcher/match_values_failure_messages.rb +30 -37
- data/spec/aws_support/deep_matcher/matchable_array.rb +0 -1
- data/spec/aws_support/deep_matcher/matchable_object.rb +1 -2
- data/spec/aws_support/deep_matcher/rspec_monkeypatches.rb +4 -4
- data/spec/aws_support/delayed_stream.rb +2 -2
- data/spec/aws_support/matchers/create_an_aws_object.rb +6 -6
- data/spec/aws_support/matchers/destroy_an_aws_object.rb +6 -6
- data/spec/aws_support/matchers/have_aws_object_tags.rb +4 -5
- data/spec/aws_support/matchers/match_an_aws_object.rb +5 -6
- data/spec/aws_support/matchers/update_an_aws_object.rb +6 -7
- data/spec/integration/aws_auto_scaling_group_spec.rb +56 -64
- data/spec/integration/aws_cache_cluster_spec.rb +70 -71
- data/spec/integration/aws_cache_subnet_group_spec.rb +13 -14
- data/spec/integration/aws_cloudsearch_domain_spec.rb +6 -8
- data/spec/integration/aws_cloudwatch_alarm_spec.rb +200 -208
- data/spec/integration/aws_dhcp_options_spec.rb +32 -43
- data/spec/integration/aws_ebs_volume_spec.rb +52 -73
- data/spec/integration/aws_eip_address_spec.rb +24 -31
- data/spec/integration/aws_elasticsearch_domain_spec.rb +31 -33
- data/spec/integration/aws_iam_instance_profile_spec.rb +36 -45
- data/spec/integration/aws_iam_role_spec.rb +39 -46
- data/spec/integration/aws_internet_gateway_spec.rb +64 -75
- data/spec/integration/aws_key_pair_spec.rb +6 -6
- data/spec/integration/aws_launch_configuration_spec.rb +17 -18
- data/spec/integration/aws_nat_gateway_spec.rb +21 -24
- data/spec/integration/aws_network_acl_spec.rb +81 -95
- data/spec/integration/aws_network_interface_spec.rb +28 -43
- data/spec/integration/aws_rds_instance_spec.rb +29 -40
- data/spec/integration/aws_rds_parameter_group_spec.rb +32 -35
- data/spec/integration/aws_rds_subnet_group_spec.rb +30 -40
- data/spec/integration/aws_route53_hosted_zone_spec.rb +205 -205
- data/spec/integration/aws_route_table_spec.rb +118 -136
- data/spec/integration/aws_s3_bucket_spec.rb +19 -27
- data/spec/integration/aws_security_group_spec.rb +369 -388
- data/spec/integration/aws_server_certificate_spec.rb +16 -18
- data/spec/integration/aws_subnet_spec.rb +44 -58
- data/spec/integration/aws_vpc_peering_connection_spec.rb +43 -50
- data/spec/integration/aws_vpc_spec.rb +99 -115
- data/spec/integration/load_balancer_spec.rb +169 -183
- data/spec/integration/machine_batch_spec.rb +24 -31
- data/spec/integration/machine_image_spec.rb +54 -66
- data/spec/integration/machine_spec.rb +216 -237
- data/spec/persistence_file.txt +219 -0
- data/spec/spec_helper.rb +16 -17
- data/spec/unit/chef/provisioning/aws_driver/credentials_spec.rb +67 -74
- data/spec/unit/chef/provisioning/aws_driver/driver_spec.rb +29 -29
- data/spec/unit/chef/provisioning/aws_driver/route53_spec.rb +13 -15
- metadata +4 -3
@@ -1,11 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Chef::Resource::MachineBatch do
|
4
4
|
extend AWSSupport
|
5
5
|
|
6
|
-
when_the_chef_12_server "exists", organization:
|
6
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
7
7
|
with_aws "with a VPC and a public subnet" do
|
8
|
-
|
9
8
|
before :all do
|
10
9
|
chef_config[:log_level] = :warn
|
11
10
|
end
|
@@ -14,62 +13,56 @@ describe Chef::Resource::MachineBatch do
|
|
14
13
|
setup_public_vpc
|
15
14
|
|
16
15
|
azs = []
|
17
|
-
driver.ec2.availability_zones.each {|az| azs << az }
|
16
|
+
driver.ec2.availability_zones.each { |az| azs << az }
|
18
17
|
az = azs[1].name
|
19
|
-
aws_subnet
|
20
|
-
vpc
|
21
|
-
cidr_block
|
18
|
+
aws_subnet "test_subnet2" do
|
19
|
+
vpc "test_vpc"
|
20
|
+
cidr_block "10.0.1.0/24"
|
22
21
|
availability_zone az
|
23
22
|
map_public_ip_on_launch true
|
24
23
|
end
|
25
24
|
|
26
25
|
it "machine_batch creates multiple machines", :super_slow do
|
27
|
-
expect_recipe
|
28
|
-
machine_batch
|
26
|
+
expect_recipe do
|
27
|
+
machine_batch "test_machines" do
|
29
28
|
action :allocate
|
30
29
|
(1..3).each do |i|
|
31
30
|
machine "test_machine#{i}" do
|
32
31
|
machine_options bootstrap_options: {
|
33
|
-
subnet_id:
|
34
|
-
key_name:
|
32
|
+
subnet_id: "test_public_subnet",
|
33
|
+
key_name: "test_key_pair"
|
35
34
|
}, source_dest_check: false
|
36
35
|
end
|
37
36
|
end
|
38
37
|
action :allocate
|
39
38
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
).and create_an_aws_instance('test_machine3',
|
45
|
-
source_dest_check: false
|
46
|
-
).and be_idempotent
|
39
|
+
end.to create_an_aws_instance("test_machine1",
|
40
|
+
source_dest_check: false).and create_an_aws_instance("test_machine2",
|
41
|
+
source_dest_check: false).and create_an_aws_instance("test_machine3",
|
42
|
+
source_dest_check: false).and be_idempotent
|
47
43
|
end
|
48
44
|
|
49
45
|
it "machine_batch supports runtime machine_options", :super_slow do
|
50
|
-
expect_recipe
|
51
|
-
subnets = %w
|
46
|
+
expect_recipe do
|
47
|
+
subnets = %w{test_public_subnet test_subnet2}
|
52
48
|
|
53
|
-
machine_batch
|
49
|
+
machine_batch "test_machines" do
|
54
50
|
action :allocate
|
55
51
|
(1..2).each do |i|
|
56
52
|
machine "test_machine#{i}" do
|
57
53
|
machine_options bootstrap_options: {
|
58
|
-
subnet_id: subnets[i-1],
|
59
|
-
key_name:
|
54
|
+
subnet_id: subnets[i - 1],
|
55
|
+
key_name: "test_key_pair"
|
60
56
|
}, source_dest_check: (i == 1)
|
61
57
|
end
|
62
58
|
end
|
63
59
|
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
source_dest_check: false
|
70
|
-
).and be_idempotent
|
60
|
+
end.to create_an_aws_instance("test_machine1",
|
61
|
+
subnet_id: test_public_subnet.aws_object.id,
|
62
|
+
source_dest_check: true).and create_an_aws_instance("test_machine2",
|
63
|
+
subnet_id: test_subnet2.aws_object.id,
|
64
|
+
source_dest_check: false).and be_idempotent
|
71
65
|
end
|
72
66
|
end
|
73
|
-
|
74
67
|
end
|
75
68
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Chef::Resource::MachineImage do
|
4
4
|
extend AWSSupport
|
5
5
|
|
6
|
-
when_the_chef_12_server "exists", organization:
|
6
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
7
7
|
with_aws "with a VPC and a public subnet" do
|
8
8
|
before :all do
|
9
9
|
chef_config[:log_level] = :warn
|
@@ -16,117 +16,105 @@ describe Chef::Resource::MachineImage do
|
|
16
16
|
setup_public_vpc
|
17
17
|
|
18
18
|
it "machine_image can create an image in the VPC", :super_slow do
|
19
|
-
expect_recipe
|
20
|
-
machine_image
|
19
|
+
expect_recipe do
|
20
|
+
machine_image "test_machine_image" do
|
21
21
|
machine_options bootstrap_options: {
|
22
|
-
subnet_id:
|
23
|
-
key_name:
|
24
|
-
instance_type:
|
22
|
+
subnet_id: "test_public_subnet",
|
23
|
+
key_name: "test_key_pair",
|
24
|
+
instance_type: "m3.medium"
|
25
25
|
},
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
ssh_options: {
|
27
|
+
timeout: 60
|
28
|
+
}
|
29
29
|
end
|
30
|
-
|
31
|
-
|
32
|
-
).and be_idempotent
|
30
|
+
end.to create_an_aws_image("test_machine_image",
|
31
|
+
name: "test_machine_image").and be_idempotent
|
33
32
|
end
|
34
33
|
|
35
|
-
describe
|
34
|
+
describe "action :destroy", :super_slow do
|
36
35
|
# with_converge does a before(:each)
|
37
|
-
with_converge
|
38
|
-
machine_image
|
36
|
+
with_converge do
|
37
|
+
machine_image "test_machine_image" do
|
39
38
|
machine_options bootstrap_options: {
|
40
|
-
subnet_id:
|
41
|
-
key_name:
|
42
|
-
instance_type:
|
39
|
+
subnet_id: "test_public_subnet",
|
40
|
+
key_name: "test_key_pair",
|
41
|
+
instance_type: "m3.medium"
|
43
42
|
},
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
ssh_options: {
|
44
|
+
timeout: 60
|
45
|
+
}
|
47
46
|
end
|
48
|
-
|
47
|
+
end
|
49
48
|
|
50
49
|
it "destroys the image" do
|
51
|
-
r = recipe
|
50
|
+
r = recipe do
|
52
51
|
machine_image "test_machine_image" do
|
53
52
|
action :destroy
|
54
53
|
end
|
55
|
-
|
56
|
-
expect(r).to destroy_an_aws_image(
|
57
|
-
).and be_idempotent
|
54
|
+
end
|
55
|
+
expect(r).to destroy_an_aws_image("test_machine_image").and be_idempotent
|
58
56
|
end
|
59
57
|
|
60
58
|
it "destroys the image if instance is gone long time ago" do
|
61
|
-
image = driver.ec2_resource.images(
|
62
|
-
image.create_tags(tags: [{key: "from-instance", value: "i-12345678"}])
|
59
|
+
image = driver.ec2_resource.images(filters: [{ name: "name", values: ["test_machine_image"] }]).first
|
60
|
+
image.create_tags(tags: [{ key: "from-instance", value: "i-12345678" }])
|
63
61
|
|
64
|
-
r = recipe
|
62
|
+
r = recipe do
|
65
63
|
machine_image "test_machine_image" do
|
66
64
|
action :destroy
|
67
65
|
end
|
68
|
-
|
69
|
-
expect(r).to destroy_an_aws_image(
|
70
|
-
).and be_idempotent
|
66
|
+
end
|
67
|
+
expect(r).to destroy_an_aws_image("test_machine_image").and be_idempotent
|
71
68
|
end
|
72
69
|
end
|
73
70
|
|
74
71
|
it "creates aws_image tags", :super_slow do
|
75
|
-
expect_recipe
|
76
|
-
machine_image
|
72
|
+
expect_recipe do
|
73
|
+
machine_image "test_machine_image" do
|
77
74
|
machine_options bootstrap_options: {
|
78
|
-
key_name:
|
79
|
-
instance_type:
|
75
|
+
key_name: "test_key_pair",
|
76
|
+
instance_type: "m3.medium"
|
80
77
|
},
|
81
|
-
|
82
|
-
|
83
|
-
|
78
|
+
ssh_options: {
|
79
|
+
timeout: 60
|
80
|
+
}
|
84
81
|
aws_tags key1: "value"
|
85
82
|
end
|
86
|
-
|
87
|
-
|
88
|
-
{
|
89
|
-
'key1' => 'value'
|
90
|
-
}
|
91
|
-
).and be_idempotent
|
83
|
+
end.to create_an_aws_image("test_machine_image").and have_aws_image_tags("test_machine_image",
|
84
|
+
"key1" => "value").and be_idempotent
|
92
85
|
end
|
93
86
|
|
94
87
|
context "with existing tags" do
|
95
|
-
machine_image
|
88
|
+
machine_image "test_machine_image" do
|
96
89
|
machine_options bootstrap_options: {
|
97
|
-
key_name:
|
98
|
-
instance_type:
|
90
|
+
key_name: "test_key_pair",
|
91
|
+
instance_type: "m3.medium"
|
99
92
|
},
|
100
|
-
|
101
|
-
|
102
|
-
|
93
|
+
ssh_options: {
|
94
|
+
timeout: 60
|
95
|
+
}
|
103
96
|
aws_tags key1: "value"
|
104
97
|
end
|
105
98
|
|
106
99
|
it "updates aws_image tags", :super_slow do
|
107
|
-
expect_recipe
|
108
|
-
machine_image
|
100
|
+
expect_recipe do
|
101
|
+
machine_image "test_machine_image" do
|
109
102
|
aws_tags key1: "value2", key2: nil
|
110
103
|
end
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
'key2' => ''
|
115
|
-
}
|
116
|
-
).and be_idempotent
|
104
|
+
end.to have_aws_image_tags("test_machine_image",
|
105
|
+
"key1" => "value2",
|
106
|
+
"key2" => "").and be_idempotent
|
117
107
|
end
|
118
108
|
|
119
109
|
it "removes all aws_image tags", :super_slow do
|
120
|
-
expect_recipe
|
121
|
-
machine_image
|
110
|
+
expect_recipe do
|
111
|
+
machine_image "test_machine_image" do
|
122
112
|
aws_tags({})
|
123
113
|
end
|
124
|
-
|
125
|
-
|
126
|
-
).and be_idempotent
|
114
|
+
end.to have_aws_image_tags("test_machine_image",
|
115
|
+
{}).and be_idempotent
|
127
116
|
end
|
128
117
|
end
|
129
|
-
|
130
118
|
end
|
131
119
|
end
|
132
120
|
end
|
@@ -1,12 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "openssl"
|
3
3
|
|
4
4
|
describe Chef::Resource::Machine do
|
5
5
|
extend AWSSupport
|
6
6
|
|
7
|
-
when_the_chef_12_server "exists", organization:
|
7
|
+
when_the_chef_12_server "exists", organization: "foo", server_scope: :context do
|
8
8
|
with_aws "with a VPC and a public subnet" do
|
9
|
-
|
10
9
|
before :all do
|
11
10
|
chef_config[:log_level] = :warn
|
12
11
|
end
|
@@ -15,34 +14,32 @@ describe Chef::Resource::Machine do
|
|
15
14
|
setup_public_vpc
|
16
15
|
|
17
16
|
it "machine with no options creates an machine", :super_slow do
|
18
|
-
expect_recipe
|
19
|
-
machine
|
17
|
+
expect_recipe do
|
18
|
+
machine "test_machine" do
|
20
19
|
action :allocate
|
21
20
|
end
|
22
|
-
|
23
|
-
).and be_idempotent
|
21
|
+
end.to create_an_aws_instance("test_machine").and be_idempotent
|
24
22
|
end
|
25
23
|
|
26
24
|
it "machine with few options allocates a machine", :super_slow do
|
27
|
-
expect_recipe
|
28
|
-
machine
|
25
|
+
expect_recipe do
|
26
|
+
machine "test_machine" do
|
29
27
|
machine_options bootstrap_options: {
|
30
|
-
subnet_id:
|
31
|
-
key_name:
|
28
|
+
subnet_id: "test_public_subnet",
|
29
|
+
key_name: "test_key_pair"
|
32
30
|
}
|
33
31
|
action :allocate
|
34
32
|
end
|
35
|
-
|
36
|
-
).and be_idempotent
|
33
|
+
end.to create_an_aws_instance("test_machine").and be_idempotent
|
37
34
|
end
|
38
35
|
|
39
36
|
it "machine with options specified as node options allocates a machine", :super_slow do
|
40
|
-
expect_recipe
|
41
|
-
machine
|
42
|
-
node.default[
|
37
|
+
expect_recipe do
|
38
|
+
machine "test_machine" do
|
39
|
+
node.default["aws_options"] = {
|
43
40
|
bootstrap_options: {
|
44
|
-
key_name:
|
45
|
-
instance_type:
|
41
|
+
key_name: "test_key_pair",
|
42
|
+
instance_type: "m3.medium",
|
46
43
|
# Need an array of hashes to test out a bug fix
|
47
44
|
network_interfaces: [
|
48
45
|
{
|
@@ -51,104 +48,99 @@ describe Chef::Resource::Machine do
|
|
51
48
|
device_index: 0,
|
52
49
|
subnet_id: test_public_subnet.aws_object.id,
|
53
50
|
delete_on_termination: true,
|
54
|
-
groups: [test_security_group.aws_object.id]
|
51
|
+
groups: [test_security_group.aws_object.id]
|
55
52
|
}
|
56
53
|
]
|
57
54
|
}
|
58
55
|
}
|
59
|
-
machine_options node[
|
56
|
+
machine_options node["aws_options"]
|
60
57
|
action :allocate
|
61
58
|
end
|
62
|
-
|
63
|
-
).and be_idempotent
|
59
|
+
end.to create_an_aws_instance("test_machine").and be_idempotent
|
64
60
|
end
|
65
61
|
|
66
62
|
it "machine with few options converges a machine", :super_slow do
|
67
|
-
expect_recipe
|
68
|
-
machine
|
63
|
+
expect_recipe do
|
64
|
+
machine "test_machine" do
|
69
65
|
machine_options bootstrap_options: {
|
70
|
-
subnet_id:
|
71
|
-
key_name:
|
66
|
+
subnet_id: "test_public_subnet",
|
67
|
+
key_name: "test_key_pair"
|
72
68
|
},
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
convergence_options: {
|
70
|
+
chef_version: "12.5.1"
|
71
|
+
}
|
76
72
|
end
|
77
|
-
|
78
|
-
)#.and be_idempotent
|
73
|
+
end.to create_an_aws_instance("test_machine") # .and be_idempotent
|
79
74
|
# Bug - machine resource with :converge action isn't idempotent
|
80
75
|
# The non-idempotence is that it runs chef again, not that it unecessarily modifies the aws_object
|
81
76
|
end
|
82
77
|
|
83
78
|
it "successfully converges a machine with custom ssh options", :super_slow do
|
84
|
-
expect_recipe
|
85
|
-
machine
|
79
|
+
expect_recipe do
|
80
|
+
machine "test_machine" do
|
86
81
|
machine_options bootstrap_options: {
|
87
|
-
subnet_id:
|
88
|
-
key_name:
|
82
|
+
subnet_id: "test_public_subnet",
|
83
|
+
key_name: "test_key_pair"
|
89
84
|
},
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
85
|
+
ssh_username: "ubuntu", # Username to use for ssh and WinRM
|
86
|
+
ssh_options: { # a list of options to Net::SSH.start
|
87
|
+
auth_methods: ["publickey"], # DEFAULT
|
88
|
+
keys_only: true, # DEFAULT
|
89
|
+
forward_agent: true, # you may want your ssh-agent to be available on your provisioned machines
|
90
|
+
remote_forwards: [
|
91
|
+
# Give remote host access to private git server
|
92
|
+
{ remote_port: 2222, local_host: "git.example.com", local_port: 22 }
|
93
|
+
],
|
94
|
+
# You can send net-ssh log info to the Chef::Log if you are having
|
95
|
+
# trouble with ssh.
|
96
|
+
logger: Chef::Log
|
97
|
+
}
|
103
98
|
end
|
104
|
-
|
105
|
-
)#.and be_idempotent
|
99
|
+
end.to create_an_aws_instance("test_machine") # .and be_idempotent
|
106
100
|
# Bug - machine resource with :converge action isn't idempotent
|
107
101
|
# The non-idempotence is that it runs chef again, not that it unecessarily modifies the aws_object
|
108
102
|
end
|
109
103
|
|
110
104
|
it "machine with source_dest_check false creates a machine with no source dest check", :super_slow do
|
111
|
-
expect_recipe
|
112
|
-
machine
|
105
|
+
expect_recipe do
|
106
|
+
machine "test_machine" do
|
113
107
|
machine_options bootstrap_options: {
|
114
|
-
subnet_id:
|
115
|
-
key_name:
|
108
|
+
subnet_id: "test_public_subnet",
|
109
|
+
key_name: "test_key_pair"
|
116
110
|
}, source_dest_check: false
|
117
111
|
action :allocate
|
118
112
|
end
|
119
|
-
|
120
|
-
|
121
|
-
).and be_idempotent
|
113
|
+
end.to create_an_aws_instance("test_machine",
|
114
|
+
source_dest_check: false).and be_idempotent
|
122
115
|
end
|
123
116
|
|
124
117
|
it "base64 encodes the user data", :super_slow do
|
125
118
|
uniq = Random.rand(100)
|
126
|
-
expect_recipe
|
119
|
+
expect_recipe do
|
127
120
|
machine "test_machine_#{uniq}" do
|
128
121
|
machine_options bootstrap_options: {
|
129
|
-
subnet_id:
|
130
|
-
key_name:
|
131
|
-
user_data:
|
122
|
+
subnet_id: "test_public_subnet",
|
123
|
+
key_name: "test_key_pair",
|
124
|
+
user_data: "echo 'foo'"
|
132
125
|
}
|
133
126
|
action :allocate
|
134
127
|
end
|
135
|
-
|
136
|
-
).and be_idempotent
|
128
|
+
end.to create_an_aws_instance("test_machine_#{uniq}").and be_idempotent
|
137
129
|
expect(
|
138
130
|
driver.ec2_client.describe_instance_attribute(
|
139
|
-
instance_id: driver.ec2_resource.instances(filters: [{name: "tag:Name", values:["test_machine_#{uniq}"]}]).first.id,
|
131
|
+
instance_id: driver.ec2_resource.instances(filters: [{ name: "tag:Name", values: ["test_machine_#{uniq}"] }]).first.id,
|
140
132
|
attribute: "userData"
|
141
133
|
).user_data.value
|
142
134
|
).to eq("ZWNobyAnZm9vJw==\n")
|
143
135
|
end
|
144
136
|
|
145
137
|
it "respects the network_interfaces block with maximum attributes", :super_slow do
|
146
|
-
private_ip_address_start = Random.rand(
|
147
|
-
expect_recipe
|
138
|
+
private_ip_address_start = Random.rand(10..39)
|
139
|
+
expect_recipe do
|
148
140
|
machine "test_machine" do
|
149
141
|
machine_options bootstrap_options: {
|
150
|
-
key_name:
|
151
|
-
instance_type:
|
142
|
+
key_name: "test_key_pair",
|
143
|
+
instance_type: "m3.medium",
|
152
144
|
network_interfaces: [
|
153
145
|
{
|
154
146
|
# Cannot set associate_public_ip_address and network_interface_id
|
@@ -161,65 +153,64 @@ describe Chef::Resource::Machine do
|
|
161
153
|
groups: [test_security_group.aws_object.id],
|
162
154
|
private_ip_addresses: [
|
163
155
|
{
|
164
|
-
private_ip_address: "10.0.0.#{private_ip_address_start+1}",
|
156
|
+
private_ip_address: "10.0.0.#{private_ip_address_start + 1}",
|
165
157
|
primary: false
|
166
158
|
},
|
167
159
|
{
|
168
|
-
private_ip_address: "10.0.0.#{private_ip_address_start+2}",
|
160
|
+
private_ip_address: "10.0.0.#{private_ip_address_start + 2}",
|
169
161
|
primary: false
|
170
162
|
}
|
171
163
|
],
|
172
164
|
# cannot specify both `private_ip_addresses` and `secondary_private_ip_address_count`
|
173
|
-
#secondary_private_ip_address_count: 2,
|
165
|
+
# secondary_private_ip_address_count: 2,
|
174
166
|
associate_public_ip_address: true
|
175
167
|
}
|
176
168
|
]
|
177
169
|
}
|
178
170
|
action :ready
|
179
171
|
end
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
).and be_idempotent
|
172
|
+
end.to create_an_aws_instance("test_machine",
|
173
|
+
network_interfaces: [{
|
174
|
+
network_interface_id: /^eni-/,
|
175
|
+
subnet_id: test_public_subnet.aws_object.id,
|
176
|
+
vpc_id: test_vpc.aws_object.id,
|
177
|
+
description: "network interface description",
|
178
|
+
status: "in-use",
|
179
|
+
private_ip_address: "10.0.0.#{private_ip_address_start}",
|
180
|
+
groups: [{ group_name: "test_security_group" }],
|
181
|
+
attachment: {
|
182
|
+
device_index: 0,
|
183
|
+
delete_on_termination: true,
|
184
|
+
status: "attached"
|
185
|
+
},
|
186
|
+
private_ip_addresses: [
|
187
|
+
{
|
188
|
+
private_ip_address: "10.0.0.#{private_ip_address_start}",
|
189
|
+
primary: true,
|
190
|
+
# the action must be :ready to give the public ip time to be assigned
|
191
|
+
association: {
|
192
|
+
public_ip: /\d+/
|
193
|
+
}
|
194
|
+
},
|
195
|
+
{
|
196
|
+
private_ip_address: "10.0.0.#{private_ip_address_start + 1}",
|
197
|
+
primary: false
|
198
|
+
},
|
199
|
+
{
|
200
|
+
private_ip_address: "10.0.0.#{private_ip_address_start + 2}",
|
201
|
+
primary: false
|
202
|
+
}
|
203
|
+
]
|
204
|
+
}]).and be_idempotent
|
214
205
|
end
|
215
206
|
|
216
207
|
it "converts associate_public_ip_address at the top level to the network interface", :super_slow do
|
217
|
-
private_ip_address_start = Random.rand(
|
218
|
-
expect_recipe
|
208
|
+
private_ip_address_start = Random.rand(10..39)
|
209
|
+
expect_recipe do
|
219
210
|
machine "test_machine" do
|
220
211
|
machine_options bootstrap_options: {
|
221
|
-
key_name:
|
222
|
-
instance_type:
|
212
|
+
key_name: "test_key_pair",
|
213
|
+
instance_type: "m3.medium",
|
223
214
|
associate_public_ip_address: true,
|
224
215
|
subnet_id: test_public_subnet.aws_object.id,
|
225
216
|
security_group_ids: [test_security_group.aws_object.id],
|
@@ -227,74 +218,72 @@ describe Chef::Resource::Machine do
|
|
227
218
|
}
|
228
219
|
action :ready
|
229
220
|
end
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
).and be_idempotent
|
221
|
+
end.to create_an_aws_instance("test_machine",
|
222
|
+
network_interfaces: [{
|
223
|
+
network_interface_id: /^eni-/,
|
224
|
+
subnet_id: test_public_subnet.aws_object.id,
|
225
|
+
vpc_id: test_vpc.aws_object.id,
|
226
|
+
status: "in-use",
|
227
|
+
private_ip_address: "10.0.0.#{private_ip_address_start}",
|
228
|
+
groups: [{ group_name: "test_security_group" }],
|
229
|
+
attachment: {
|
230
|
+
device_index: 0,
|
231
|
+
delete_on_termination: true,
|
232
|
+
status: "attached"
|
233
|
+
},
|
234
|
+
private_ip_addresses: [
|
235
|
+
{
|
236
|
+
private_ip_address: "10.0.0.#{private_ip_address_start}",
|
237
|
+
primary: true,
|
238
|
+
association: {
|
239
|
+
public_ip: /\d+/
|
240
|
+
}
|
241
|
+
}
|
242
|
+
]
|
243
|
+
}]).and be_idempotent
|
254
244
|
end
|
255
245
|
|
256
246
|
context "with a placement group" do
|
257
|
-
before(:context)
|
247
|
+
before(:context) do
|
258
248
|
begin
|
259
|
-
driver.ec2_client.create_placement_group(
|
249
|
+
driver.ec2_client.create_placement_group(
|
260
250
|
group_name: "agroup",
|
261
251
|
strategy: "cluster"
|
262
|
-
|
252
|
+
)
|
263
253
|
rescue ::Aws::EC2::Errors::InvalidPlacementGroupDuplicate
|
264
254
|
# We don't need to create it because it already exists
|
265
255
|
end
|
266
|
-
|
256
|
+
end
|
267
257
|
|
268
258
|
# Must do after the context so we have waited for the instance to terminate
|
269
|
-
after(:context)
|
259
|
+
after(:context) do
|
270
260
|
driver.ec2_client.delete_placement_group group_name: "agroup"
|
271
|
-
|
261
|
+
end
|
272
262
|
|
273
263
|
it "converts V1 keys to V2 keys", :super_slow do
|
274
|
-
expect_recipe
|
264
|
+
expect_recipe do
|
275
265
|
machine "test_machine" do
|
276
266
|
machine_options bootstrap_options: {
|
277
|
-
key_name:
|
278
|
-
instance_type:
|
267
|
+
key_name: "test_key_pair",
|
268
|
+
instance_type: "m4.large",
|
279
269
|
monitoring_enabled: false,
|
280
270
|
availability_zone: test_public_subnet.aws_object.availability_zone_name,
|
281
271
|
placement_group: "agroup",
|
282
272
|
dedicated_tenancy: false, # cannot do true, was getting API error
|
283
|
-
subnet:
|
273
|
+
subnet: "test_public_subnet"
|
284
274
|
}
|
285
275
|
action :allocate
|
286
276
|
end
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
).and be_idempotent
|
277
|
+
end.to create_an_aws_instance("test_machine",
|
278
|
+
monitoring: { state: "disabled" },
|
279
|
+
placement: {
|
280
|
+
availability_zone: test_public_subnet.aws_object.availability_zone_name,
|
281
|
+
group_name: "agroup",
|
282
|
+
tenancy: "default"
|
283
|
+
},
|
284
|
+
subnet_id: test_public_subnet.aws_object.id).and be_idempotent
|
296
285
|
end
|
297
|
-
|
286
|
+
end
|
298
287
|
|
299
288
|
context "with a custom iam role" do
|
300
289
|
assume_role_policy_document = '{"Version":"2008-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":["ec2.amazonaws.com"]},"Action":["sts:AssumeRole"]}]}'
|
@@ -309,181 +298,173 @@ describe Chef::Resource::Machine do
|
|
309
298
|
end
|
310
299
|
|
311
300
|
it "converts iam_instance_profile from a string to a hash", :super_slow do
|
312
|
-
expect_recipe
|
313
|
-
machine
|
301
|
+
expect_recipe do
|
302
|
+
machine "test_machine" do
|
314
303
|
machine_options bootstrap_options: {
|
315
|
-
subnet_id:
|
316
|
-
key_name:
|
304
|
+
subnet_id: "test_public_subnet",
|
305
|
+
key_name: "test_key_pair",
|
317
306
|
iam_instance_profile: "machine_test_instance_profile"
|
318
307
|
}
|
319
308
|
action :allocate
|
320
309
|
end
|
321
|
-
|
322
|
-
|
323
|
-
).and be_idempotent
|
310
|
+
end.to create_an_aws_instance("test_machine",
|
311
|
+
iam_instance_profile: { arn: /machine_test_instance_profile/ }).and be_idempotent
|
324
312
|
end
|
325
313
|
|
326
314
|
it "looks up the iam_instance_profile from the arn", :super_slow do
|
327
|
-
expect_recipe
|
328
|
-
machine
|
315
|
+
expect_recipe do
|
316
|
+
machine "test_machine" do
|
329
317
|
machine_options bootstrap_options: {
|
330
|
-
subnet_id:
|
331
|
-
key_name:
|
332
|
-
iam_instance_profile: {arn: machine_test_instance_profile.aws_object.arn}
|
318
|
+
subnet_id: "test_public_subnet",
|
319
|
+
key_name: "test_key_pair",
|
320
|
+
iam_instance_profile: { arn: machine_test_instance_profile.aws_object.arn }
|
333
321
|
}
|
334
322
|
action :allocate
|
335
323
|
end
|
336
|
-
|
337
|
-
|
338
|
-
).and be_idempotent
|
324
|
+
end.to create_an_aws_instance("test_machine",
|
325
|
+
iam_instance_profile: { arn: /machine_test_instance_profile/ }).and be_idempotent
|
339
326
|
end
|
340
327
|
end
|
341
328
|
|
342
329
|
it "machine with from_image option is created from correct image", :super_slow do
|
343
|
-
expect_recipe
|
344
|
-
|
345
|
-
machine_image 'test_machine_ami' do
|
330
|
+
expect_recipe do
|
331
|
+
machine_image "test_machine_ami" do
|
346
332
|
machine_options bootstrap_options: {
|
347
|
-
subnet_id:
|
348
|
-
key_name:
|
333
|
+
subnet_id: "test_public_subnet",
|
334
|
+
key_name: "test_key_pair"
|
349
335
|
}
|
350
336
|
end
|
351
337
|
|
352
|
-
machine
|
353
|
-
from_image
|
338
|
+
machine "test_machine" do
|
339
|
+
from_image "test_machine_ami"
|
354
340
|
machine_options bootstrap_options: {
|
355
|
-
subnet_id:
|
356
|
-
key_name:
|
341
|
+
subnet_id: "test_public_subnet",
|
342
|
+
key_name: "test_key_pair"
|
357
343
|
}
|
358
344
|
action :allocate
|
359
345
|
end
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
name: 'test_machine_ami'
|
364
|
-
).and be_idempotent
|
346
|
+
end.to create_an_aws_instance("test_machine",
|
347
|
+
image_id: driver.ec2.images.filter("name", "test_machine_ami").first.image_id).and create_an_aws_image("test_machine_ami",
|
348
|
+
name: "test_machine_ami").and be_idempotent
|
365
349
|
end
|
366
350
|
|
367
351
|
context "with an existing machine", :super_slow do
|
368
|
-
machine
|
352
|
+
machine "test_machine" do
|
369
353
|
machine_options bootstrap_options: {
|
370
|
-
subnet_id:
|
371
|
-
key_name:
|
354
|
+
subnet_id: "test_public_subnet",
|
355
|
+
key_name: "test_key_pair"
|
372
356
|
}
|
373
357
|
action :allocate
|
374
358
|
end
|
375
359
|
|
376
360
|
it "stops the machine with the :stop action" do
|
377
|
-
expect_recipe
|
378
|
-
machine
|
361
|
+
expect_recipe do
|
362
|
+
machine "test_machine" do
|
379
363
|
action :stop
|
380
364
|
end
|
381
|
-
|
382
|
-
|
383
|
-
).and be_idempotent
|
365
|
+
end.to update_an_aws_instance("test_machine",
|
366
|
+
state: { name: "stopped" }).and be_idempotent
|
384
367
|
end
|
385
368
|
|
386
369
|
it "starts a machine that has been stopped" do
|
387
|
-
expect_recipe
|
388
|
-
machine
|
370
|
+
expect_recipe do
|
371
|
+
machine "test_machine" do
|
389
372
|
action :stop
|
390
373
|
end
|
391
|
-
machine
|
374
|
+
machine "test_machine" do
|
392
375
|
action :ready
|
393
376
|
end
|
394
|
-
|
395
|
-
|
396
|
-
)
|
377
|
+
end.to update_an_aws_instance("test_machine",
|
378
|
+
state: { name: "running" })
|
397
379
|
end
|
398
380
|
end
|
399
381
|
|
400
382
|
it "doesn't create a machine if the initial action is :stop", :super_slow do
|
401
|
-
expect_recipe
|
402
|
-
machine
|
383
|
+
expect_recipe do
|
384
|
+
machine "test_machine" do
|
403
385
|
action :stop
|
404
386
|
end
|
405
|
-
|
387
|
+
end.not_to create_an_aws_instance("test_machine")
|
406
388
|
end
|
407
389
|
|
408
390
|
it "can correctly destroy a machine", :super_slow do
|
409
|
-
converge
|
410
|
-
machine
|
391
|
+
converge do
|
392
|
+
machine "test_machine1" do
|
411
393
|
action :allocate
|
412
394
|
end
|
413
|
-
|
414
|
-
r = recipe
|
415
|
-
machine
|
395
|
+
end
|
396
|
+
r = recipe do
|
397
|
+
machine "test_machine1" do
|
416
398
|
action :destroy
|
417
399
|
end
|
418
|
-
|
419
|
-
expect(r).to destroy_an_aws_instance(
|
400
|
+
end
|
401
|
+
expect(r).to destroy_an_aws_instance("test_machine1")
|
420
402
|
end
|
421
403
|
|
422
404
|
# Tests https://github.com/chef/chef-provisioning-aws/issues/189
|
423
405
|
it "correctly finds the driver_url when switching between machine and aws_instance", :super_slow do
|
424
|
-
converge
|
425
|
-
machine
|
406
|
+
converge do
|
407
|
+
machine "test_machine2" do
|
426
408
|
action :allocate
|
427
409
|
end
|
428
|
-
|
429
|
-
r = recipe
|
430
|
-
aws_instance
|
410
|
+
end
|
411
|
+
r = recipe do
|
412
|
+
aws_instance "test_machine2" do
|
431
413
|
action :destroy
|
432
414
|
end
|
433
|
-
|
434
|
-
expect(r).to destroy_an_aws_instance(
|
415
|
+
end
|
416
|
+
expect(r).to destroy_an_aws_instance("test_machine2")
|
435
417
|
end
|
436
418
|
|
437
419
|
context "with a custom key" do
|
438
|
-
let(:private_key)
|
420
|
+
let(:private_key) do
|
439
421
|
k = OpenSSL::PKey::RSA.new(2048)
|
440
422
|
f = Pathname.new(private_key_path)
|
441
423
|
f.write(k.to_pem)
|
442
424
|
k
|
443
|
-
|
444
|
-
let(:private_key_pem)
|
425
|
+
end
|
426
|
+
let(:private_key_pem) do
|
445
427
|
private_key.to_pem
|
446
|
-
|
447
|
-
let(:private_key_path)
|
448
|
-
Pathname.new(ENV[
|
449
|
-
|
450
|
-
let(:public_key) {private_key.public_key}
|
428
|
+
end
|
429
|
+
let(:private_key_path) do
|
430
|
+
Pathname.new(ENV["HOME"]).join(".ssh", key_pair_name).expand_path
|
431
|
+
end
|
432
|
+
let(:public_key) { private_key.public_key }
|
451
433
|
let(:key_pair_name) { "test_key_pair_#{Random.rand(100)}" }
|
452
434
|
|
453
435
|
before do
|
454
|
-
driver.ec2_client.import_key_pair(
|
436
|
+
driver.ec2_client.import_key_pair(
|
455
437
|
key_name: key_pair_name, # required
|
456
438
|
public_key_material: "#{public_key.ssh_type} #{[public_key.to_blob].pack('m0')}", # required
|
457
|
-
|
439
|
+
)
|
458
440
|
end
|
459
441
|
|
460
442
|
after do
|
461
|
-
driver.ec2_client.delete_key_pair(
|
443
|
+
driver.ec2_client.delete_key_pair(
|
462
444
|
key_name: key_pair_name, # required
|
463
|
-
|
445
|
+
)
|
464
446
|
Pathname.new(private_key_path).delete
|
465
447
|
end
|
466
448
|
|
467
449
|
it "strips key_path from the bootstrap options when creating the machine", :super_slow do
|
468
|
-
expect_recipe
|
469
|
-
machine
|
450
|
+
expect_recipe do
|
451
|
+
machine "test_machine" do
|
470
452
|
machine_options bootstrap_options: {
|
471
|
-
instance_type:
|
453
|
+
instance_type: "t2.medium",
|
472
454
|
key_name: key_pair_name,
|
473
455
|
key_path: private_key_path
|
474
456
|
}
|
475
457
|
action :ready
|
476
458
|
end
|
477
|
-
|
478
|
-
).and be_idempotent
|
459
|
+
end.to create_an_aws_instance("test_machine").and be_idempotent
|
479
460
|
end
|
480
461
|
|
481
462
|
it "uses key_data from the ssh_options", :super_slow do
|
482
|
-
expect_recipe
|
483
|
-
machine
|
463
|
+
expect_recipe do
|
464
|
+
machine "test_machine" do
|
484
465
|
machine_options(
|
485
466
|
bootstrap_options: {
|
486
|
-
instance_type:
|
467
|
+
instance_type: "t2.medium",
|
487
468
|
key_name: key_pair_name
|
488
469
|
},
|
489
470
|
ssh_options: {
|
@@ -492,11 +473,9 @@ describe Chef::Resource::Machine do
|
|
492
473
|
)
|
493
474
|
action :ready
|
494
475
|
end
|
495
|
-
|
496
|
-
).and be_idempotent
|
476
|
+
end.to create_an_aws_instance("test_machine").and be_idempotent
|
497
477
|
end
|
498
478
|
end
|
499
|
-
|
500
479
|
end
|
501
480
|
end
|
502
481
|
end
|