chef-provisioning-aws 1.6.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -0
  3. data/Rakefile +8 -5
  4. data/chef-provisioning-aws.gemspec +3 -3
  5. data/lib/chef/provider/aws_cloudsearch_domain.rb +5 -3
  6. data/lib/chef/provider/aws_elasticsearch_domain.rb +131 -0
  7. data/lib/chef/provider/aws_key_pair.rb +2 -2
  8. data/lib/chef/provider/aws_rds_instance.rb +7 -5
  9. data/lib/chef/provider/aws_rds_subnet_group.rb +7 -7
  10. data/lib/chef/provider/aws_route_table.rb +5 -1
  11. data/lib/chef/provider/aws_server_certificate.rb +4 -3
  12. data/lib/chef/provisioning/aws_driver.rb +1 -0
  13. data/lib/chef/provisioning/aws_driver/aws_provider.rb +2 -1
  14. data/lib/chef/provisioning/aws_driver/driver.rb +109 -38
  15. data/lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb +40 -0
  16. data/lib/chef/provisioning/aws_driver/version.rb +1 -1
  17. data/lib/chef/resource/aws_eip_address.rb +4 -24
  18. data/lib/chef/resource/aws_elasticsearch_domain.rb +42 -0
  19. data/lib/chef/resource/aws_rds_instance.rb +12 -7
  20. data/lib/chef/resource/aws_route53_hosted_zone.rb +1 -1
  21. data/spec/aws_support.rb +2 -2
  22. data/spec/integration/aws_eip_address_spec.rb +32 -18
  23. data/spec/integration/aws_elasticsearch_domain_spec.rb +119 -0
  24. data/spec/integration/aws_key_pair_spec.rb +2 -1
  25. data/spec/integration/aws_rds_instance_spec.rb +3 -3
  26. data/spec/integration/aws_route53_hosted_zone_spec.rb +11 -0
  27. data/spec/integration/aws_route_table_spec.rb +40 -44
  28. data/spec/integration/aws_server_certificate_spec.rb +12 -0
  29. data/spec/integration/load_balancer_spec.rb +47 -1
  30. data/spec/integration/machine_spec.rb +32 -25
  31. metadata +28 -6
@@ -80,6 +80,18 @@ CHAIN
80
80
  :certificate_chain => certificate_chain_string.strip
81
81
  ).and be_idempotent
82
82
  end
83
+
84
+ it "creates a cert without a certificate_chain" do
85
+ expect_recipe {
86
+ aws_server_certificate "test-cert" do
87
+ certificate_body cert_string
88
+ private_key private_key_string
89
+ end
90
+ }.to create_an_aws_server_certificate("test-cert",
91
+ :certificate_body => cert_string.strip,
92
+ :certificate_chain => nil
93
+ ).and be_idempotent
94
+ end
83
95
  end
84
96
  end
85
97
  end
@@ -52,6 +52,10 @@ describe Chef::Resource::LoadBalancer do
52
52
  unhealthy_threshold: 2,
53
53
  healthy_threshold: 2
54
54
  },
55
+ sticky_sessions: {
56
+ cookie_name: 'test-cookie-name',
57
+ ports: [80, 443]
58
+ },
55
59
  scheme: "internal",
56
60
  attributes: {
57
61
  cross_zone_load_balancing: {
@@ -83,7 +87,7 @@ describe Chef::Resource::LoadBalancer do
83
87
  })
84
88
  end
85
89
  }.to create_an_aws_load_balancer('test-load-balancer', {
86
- listeners: [
90
+ listeners: Set[
87
91
  {
88
92
  :port => 80,
89
93
  :protocol => :http,
@@ -127,6 +131,23 @@ describe Chef::Resource::LoadBalancer do
127
131
  idle_timeout: 1,
128
132
  }
129
133
  })
134
+ stickiness_policy = driver.elb_client.describe_load_balancer_policies(load_balancer_name: 'test-load-balancer')[:policy_descriptions].detect { |pd| pd[:policy_type_name] == 'AppCookieStickinessPolicyType' }.to_h
135
+ expect(stickiness_policy).to eq(
136
+ {
137
+ policy_attribute_descriptions: [
138
+ {attribute_value: "test-cookie-name", attribute_name: "CookieName"}
139
+ ],
140
+ policy_type_name: "AppCookieStickinessPolicyType",
141
+ policy_name: "test-load-balancer-sticky-session-policy"
142
+ }
143
+ )
144
+
145
+ listener_descriptions = driver.elb_client.describe_load_balancers(load_balancer_names: ['test-load-balancer'])[:load_balancer_descriptions][0][:listener_descriptions]
146
+ expect(listener_descriptions.size).to eql(2)
147
+ http_listener = listener_descriptions.detect { |ld| ld[:listener][:load_balancer_port] == 80 }
148
+ https_listener = listener_descriptions.detect { |ld| ld[:listener][:load_balancer_port] == 443 }
149
+ expect(http_listener[:policy_names]).to include('test-load-balancer-sticky-session-policy')
150
+ expect(https_listener[:policy_names]).to include('test-load-balancer-sticky-session-policy')
130
151
  end
131
152
 
132
153
  context 'with an existing load balancer' do
@@ -162,6 +183,10 @@ describe Chef::Resource::LoadBalancer do
162
183
  unhealthy_threshold: 2,
163
184
  healthy_threshold: 2
164
185
  },
186
+ sticky_sessions: {
187
+ cookie_name: 'test-cookie-name',
188
+ ports: [80]
189
+ },
165
190
  scheme: "internal",
166
191
  attributes: {
167
192
  cross_zone_load_balancing: {
@@ -204,6 +229,10 @@ describe Chef::Resource::LoadBalancer do
204
229
  unhealthy_threshold: 3,
205
230
  healthy_threshold: 3
206
231
  },
232
+ sticky_sessions: {
233
+ cookie_name: 'test-cookie-name2',
234
+ ports: [443]
235
+ },
207
236
  # scheme is immutable, we cannot update it
208
237
  #scheme: "internet-facing",
209
238
  attributes: {
@@ -245,6 +274,7 @@ describe Chef::Resource::LoadBalancer do
245
274
  },
246
275
  scheme: "internal"
247
276
  }).and be_idempotent
277
+
248
278
  expect(
249
279
  driver.elb_client.describe_load_balancer_attributes(load_balancer_name: "test-load-balancer").to_h
250
280
  ).to eq(load_balancer_attributes: {
@@ -265,6 +295,22 @@ describe Chef::Resource::LoadBalancer do
265
295
  idle_timeout: 10,
266
296
  }
267
297
  })
298
+
299
+ stickiness_policy = driver.elb_client.describe_load_balancer_policies(load_balancer_name: 'test-load-balancer')[:policy_descriptions].detect { |pd| pd[:policy_type_name] == 'AppCookieStickinessPolicyType' }.to_h
300
+ expect(stickiness_policy).to eq(
301
+ {
302
+ policy_attribute_descriptions: [
303
+ {attribute_value: "test-cookie-name2", attribute_name: "CookieName"}
304
+ ],
305
+ policy_type_name: "AppCookieStickinessPolicyType",
306
+ policy_name: "test-load-balancer-sticky-session-policy"
307
+ }
308
+ )
309
+
310
+ listener_descriptions = driver.elb_client.describe_load_balancers(load_balancer_names: ['test-load-balancer'])[:load_balancer_descriptions][0][:listener_descriptions]
311
+ expect(listener_descriptions.size).to eql(1)
312
+ https_listener = listener_descriptions.detect { |ld| ld[:listener][:load_balancer_port] == 443 }
313
+ expect(https_listener[:policy_names]).to include('test-load-balancer-sticky-session-policy')
268
314
  end
269
315
  end
270
316
 
@@ -14,6 +14,15 @@ describe Chef::Resource::Machine do
14
14
  purge_all
15
15
  setup_public_vpc
16
16
 
17
+ it "machine with no options creates an machine", :super_slow do
18
+ expect_recipe {
19
+ machine 'test_machine' do
20
+ action :allocate
21
+ end
22
+ }.to create_an_aws_instance('test_machine'
23
+ ).and be_idempotent
24
+ end
25
+
17
26
  it "machine with few options allocates a machine", :super_slow do
18
27
  expect_recipe {
19
28
  machine 'test_machine' do
@@ -33,11 +42,15 @@ describe Chef::Resource::Machine do
33
42
  machine_options bootstrap_options: {
34
43
  subnet_id: 'test_public_subnet',
35
44
  key_name: 'test_key_pair'
45
+ },
46
+ convergence_options: {
47
+ chef_version: "12.5.1"
36
48
  }
37
- action :allocate
38
49
  end
39
50
  }.to create_an_aws_instance('test_machine'
40
- ).and be_idempotent
51
+ )#.and be_idempotent
52
+ # Bug - machine resource with :converge action isn't idempotent
53
+ # The non-idempotence is that it runs chef again, not that it unecessarily modifies the aws_object
41
54
  end
42
55
 
43
56
  it "machine with source_dest_check false creates a machine with no source dest check", :super_slow do
@@ -337,40 +350,34 @@ describe Chef::Resource::Machine do
337
350
  end
338
351
  }.not_to create_an_aws_instance('test_machine')
339
352
  end
340
- end
341
-
342
- with_aws "Without a VPC" do
343
-
344
- before :all do
345
- chef_config[:log_level] = :warn
346
- end
347
353
 
348
- #purge_all
349
- it "machine with no options creates an machine", :super_slow do
350
- expect_recipe {
351
- aws_key_pair 'test_key_pair' do
352
- allow_overwrite true
353
- end
354
- machine 'test_machine' do
355
- machine_options bootstrap_options: { key_name: 'test_key_pair' }
354
+ it "can correctly destroy a machine", :super_slow do
355
+ converge {
356
+ machine 'test_machine1' do
356
357
  action :allocate
357
358
  end
358
- }.to create_an_aws_instance('test_machine'
359
- ).and create_an_aws_key_pair('test_key_pair'
360
- ).and be_idempotent
359
+ }
360
+ r = recipe {
361
+ machine 'test_machine1' do
362
+ action :destroy
363
+ end
364
+ }
365
+ expect(r).to destroy_an_aws_instance('test_machine1')
361
366
  end
362
367
 
363
368
  # Tests https://github.com/chef/chef-provisioning-aws/issues/189
364
369
  it "correctly finds the driver_url when switching between machine and aws_instance", :super_slow do
365
- expect { recipe {
366
- machine 'test-machine-driver' do
370
+ converge {
371
+ machine 'test_machine2' do
367
372
  action :allocate
368
373
  end
369
- aws_instance 'test-machine-driver'
370
- machine 'test-machine-driver' do
374
+ }
375
+ r = recipe {
376
+ aws_instance 'test_machine2' do
371
377
  action :destroy
372
378
  end
373
- }.converge }.to_not raise_error
379
+ }
380
+ expect(r).to destroy_an_aws_instance('test_machine2')
374
381
  end
375
382
 
376
383
  # https://github.com/chef/chef-provisioning-aws/pull/295
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Ewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-provisioning
@@ -42,21 +42,30 @@ dependencies:
42
42
  name: aws-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.1'
47
+ version: 2.1.26
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '3.0'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
53
56
  - !ruby/object:Gem::Version
54
- version: '2.1'
57
+ version: 2.1.26
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: retryable
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
65
  - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.0'
68
+ - - ">="
60
69
  - !ruby/object:Gem::Version
61
70
  version: 2.0.1
62
71
  type: :runtime
@@ -64,6 +73,9 @@ dependencies:
64
73
  version_requirements: !ruby/object:Gem::Requirement
65
74
  requirements:
66
75
  - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '2.0'
78
+ - - ">="
67
79
  - !ruby/object:Gem::Version
68
80
  version: 2.0.1
69
81
  - !ruby/object:Gem::Dependency
@@ -71,6 +83,9 @@ dependencies:
71
83
  requirement: !ruby/object:Gem::Requirement
72
84
  requirements:
73
85
  - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '0.4'
88
+ - - ">="
74
89
  - !ruby/object:Gem::Version
75
90
  version: 0.4.1
76
91
  type: :runtime
@@ -78,6 +93,9 @@ dependencies:
78
93
  version_requirements: !ruby/object:Gem::Requirement
79
94
  requirements:
80
95
  - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.4'
98
+ - - ">="
81
99
  - !ruby/object:Gem::Version
82
100
  version: 0.4.1
83
101
  - !ruby/object:Gem::Dependency
@@ -199,6 +217,7 @@ files:
199
217
  - lib/chef/provider/aws_dhcp_options.rb
200
218
  - lib/chef/provider/aws_ebs_volume.rb
201
219
  - lib/chef/provider/aws_eip_address.rb
220
+ - lib/chef/provider/aws_elasticsearch_domain.rb
202
221
  - lib/chef/provider/aws_iam_instance_profile.rb
203
222
  - lib/chef/provider/aws_iam_role.rb
204
223
  - lib/chef/provider/aws_image.rb
@@ -234,6 +253,7 @@ files:
234
253
  - lib/chef/provisioning/aws_driver/resources.rb
235
254
  - lib/chef/provisioning/aws_driver/super_lwrp.rb
236
255
  - lib/chef/provisioning/aws_driver/tagging_strategy/ec2.rb
256
+ - lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb
237
257
  - lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb
238
258
  - lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb
239
259
  - lib/chef/provisioning/aws_driver/tagging_strategy/s3.rb
@@ -247,6 +267,7 @@ files:
247
267
  - lib/chef/resource/aws_dhcp_options.rb
248
268
  - lib/chef/resource/aws_ebs_volume.rb
249
269
  - lib/chef/resource/aws_eip_address.rb
270
+ - lib/chef/resource/aws_elasticsearch_domain.rb
250
271
  - lib/chef/resource/aws_iam_instance_profile.rb
251
272
  - lib/chef/resource/aws_iam_role.rb
252
273
  - lib/chef/resource/aws_image.rb
@@ -289,6 +310,7 @@ files:
289
310
  - spec/integration/aws_dhcp_options_spec.rb
290
311
  - spec/integration/aws_ebs_volume_spec.rb
291
312
  - spec/integration/aws_eip_address_spec.rb
313
+ - spec/integration/aws_elasticsearch_domain_spec.rb
292
314
  - spec/integration/aws_iam_instance_profile_spec.rb
293
315
  - spec/integration/aws_iam_role_spec.rb
294
316
  - spec/integration/aws_internet_gateway_spec.rb