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.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -5
  3. data/Rakefile +15 -6
  4. data/chef-provisioning-aws.gemspec +17 -17
  5. data/lib/chef/provider/aws_auto_scaling_group.rb +5 -6
  6. data/lib/chef/provider/aws_cache_cluster.rb +21 -15
  7. data/lib/chef/provider/aws_cache_replication_group.rb +12 -8
  8. data/lib/chef/provider/aws_cache_subnet_group.rb +3 -3
  9. data/lib/chef/provider/aws_cloudsearch_domain.rb +9 -13
  10. data/lib/chef/provider/aws_cloudwatch_alarm.rb +10 -12
  11. data/lib/chef/provider/aws_dhcp_options.rb +18 -21
  12. data/lib/chef/provider/aws_ebs_volume.rb +24 -26
  13. data/lib/chef/provider/aws_eip_address.rb +10 -13
  14. data/lib/chef/provider/aws_elasticsearch_domain.rb +19 -18
  15. data/lib/chef/provider/aws_iam_instance_profile.rb +5 -7
  16. data/lib/chef/provider/aws_iam_role.rb +14 -17
  17. data/lib/chef/provider/aws_image.rb +6 -6
  18. data/lib/chef/provider/aws_instance.rb +5 -5
  19. data/lib/chef/provider/aws_internet_gateway.rb +8 -11
  20. data/lib/chef/provider/aws_key_pair.rb +15 -17
  21. data/lib/chef/provider/aws_launch_configuration.rb +11 -14
  22. data/lib/chef/provider/aws_load_balancer.rb +1 -2
  23. data/lib/chef/provider/aws_nat_gateway.rb +6 -7
  24. data/lib/chef/provider/aws_network_acl.rb +28 -29
  25. data/lib/chef/provider/aws_network_interface.rb +25 -27
  26. data/lib/chef/provider/aws_rds_instance.rb +12 -13
  27. data/lib/chef/provider/aws_rds_parameter_group.rb +8 -8
  28. data/lib/chef/provider/aws_rds_subnet_group.rb +8 -9
  29. data/lib/chef/provider/aws_route_table.rb +19 -20
  30. data/lib/chef/provider/aws_s3_bucket.rb +22 -25
  31. data/lib/chef/provider/aws_security_group.rb +268 -285
  32. data/lib/chef/provider/aws_server_certificate.rb +6 -5
  33. data/lib/chef/provider/aws_sns_topic.rb +4 -6
  34. data/lib/chef/provider/aws_sqs_queue.rb +3 -4
  35. data/lib/chef/provider/aws_subnet.rb +29 -34
  36. data/lib/chef/provider/aws_vpc.rb +108 -116
  37. data/lib/chef/provider/aws_vpc_peering_connection.rb +11 -11
  38. data/lib/chef/provisioning/aws_driver.rb +4 -2
  39. data/lib/chef/provisioning/aws_driver/aws_provider.rb +234 -241
  40. data/lib/chef/provisioning/aws_driver/aws_rds_resource.rb +5 -7
  41. data/lib/chef/provisioning/aws_driver/aws_resource.rb +182 -185
  42. data/lib/chef/provisioning/aws_driver/aws_resource_with_entry.rb +17 -17
  43. data/lib/chef/provisioning/aws_driver/aws_taggable.rb +13 -15
  44. data/lib/chef/provisioning/aws_driver/aws_tagger.rb +47 -48
  45. data/lib/chef/provisioning/aws_driver/credentials.rb +96 -100
  46. data/lib/chef/provisioning/aws_driver/credentials2.rb +42 -45
  47. data/lib/chef/provisioning/aws_driver/driver.rb +1349 -1362
  48. data/lib/chef/provisioning/aws_driver/exceptions.rb +10 -12
  49. data/lib/chef/provisioning/aws_driver/super_lwrp.rb +60 -60
  50. data/lib/chef/provisioning/aws_driver/tagging_strategy/auto_scaling.rb +49 -50
  51. data/lib/chef/provisioning/aws_driver/tagging_strategy/ec2.rb +37 -38
  52. data/lib/chef/provisioning/aws_driver/tagging_strategy/elasticsearch.rb +14 -15
  53. data/lib/chef/provisioning/aws_driver/tagging_strategy/elb.rb +29 -31
  54. data/lib/chef/provisioning/aws_driver/tagging_strategy/rds.rb +39 -40
  55. data/lib/chef/provisioning/aws_driver/tagging_strategy/s3.rb +41 -43
  56. data/lib/chef/provisioning/aws_driver/version.rb +5 -5
  57. data/lib/chef/provisioning/driver_init/aws.rb +2 -2
  58. data/lib/chef/resource/aws_auto_scaling_group.rb +1 -1
  59. data/lib/chef/resource/aws_cache_cluster.rb +9 -12
  60. data/lib/chef/resource/aws_cache_replication_group.rb +9 -11
  61. data/lib/chef/resource/aws_cache_subnet_group.rb +8 -10
  62. data/lib/chef/resource/aws_cloudsearch_domain.rb +4 -5
  63. data/lib/chef/resource/aws_cloudwatch_alarm.rb +17 -18
  64. data/lib/chef/resource/aws_dhcp_options.rb +2 -2
  65. data/lib/chef/resource/aws_ebs_volume.rb +10 -10
  66. data/lib/chef/resource/aws_eip_address.rb +5 -5
  67. data/lib/chef/resource/aws_elasticsearch_domain.rb +4 -4
  68. data/lib/chef/resource/aws_iam_instance_profile.rb +4 -5
  69. data/lib/chef/resource/aws_iam_role.rb +2 -3
  70. data/lib/chef/resource/aws_image.rb +3 -3
  71. data/lib/chef/resource/aws_instance.rb +4 -4
  72. data/lib/chef/resource/aws_internet_gateway.rb +3 -3
  73. data/lib/chef/resource/aws_key_pair.rb +7 -7
  74. data/lib/chef/resource/aws_launch_configuration.rb +4 -4
  75. data/lib/chef/resource/aws_load_balancer.rb +7 -7
  76. data/lib/chef/resource/aws_nat_gateway.rb +11 -11
  77. data/lib/chef/resource/aws_network_acl.rb +7 -8
  78. data/lib/chef/resource/aws_network_interface.rb +9 -9
  79. data/lib/chef/resource/aws_rds_instance.rb +4 -4
  80. data/lib/chef/resource/aws_rds_parameter_group.rb +3 -3
  81. data/lib/chef/resource/aws_rds_subnet_group.rb +4 -4
  82. data/lib/chef/resource/aws_route53_hosted_zone.rb +37 -40
  83. data/lib/chef/resource/aws_route53_record_set.rb +22 -24
  84. data/lib/chef/resource/aws_route_table.rb +7 -7
  85. data/lib/chef/resource/aws_s3_bucket.rb +7 -7
  86. data/lib/chef/resource/aws_security_group.rb +10 -10
  87. data/lib/chef/resource/aws_server_certificate.rb +6 -8
  88. data/lib/chef/resource/aws_sns_topic.rb +2 -2
  89. data/lib/chef/resource/aws_sqs_queue.rb +5 -7
  90. data/lib/chef/resource/aws_subnet.rb +9 -9
  91. data/lib/chef/resource/aws_vpc.rb +11 -11
  92. data/lib/chef/resource/aws_vpc_peering_connection.rb +4 -4
  93. data/spec/aws_support.rb +44 -45
  94. data/spec/aws_support/aws_resource_run_wrapper.rb +2 -2
  95. data/spec/aws_support/deep_matcher.rb +2 -3
  96. data/spec/aws_support/deep_matcher/fuzzy_match_objects.rb +6 -9
  97. data/spec/aws_support/deep_matcher/match_values_failure_messages.rb +30 -37
  98. data/spec/aws_support/deep_matcher/matchable_array.rb +0 -1
  99. data/spec/aws_support/deep_matcher/matchable_object.rb +1 -2
  100. data/spec/aws_support/deep_matcher/rspec_monkeypatches.rb +4 -4
  101. data/spec/aws_support/delayed_stream.rb +2 -2
  102. data/spec/aws_support/matchers/create_an_aws_object.rb +6 -6
  103. data/spec/aws_support/matchers/destroy_an_aws_object.rb +6 -6
  104. data/spec/aws_support/matchers/have_aws_object_tags.rb +4 -5
  105. data/spec/aws_support/matchers/match_an_aws_object.rb +5 -6
  106. data/spec/aws_support/matchers/update_an_aws_object.rb +6 -7
  107. data/spec/integration/aws_auto_scaling_group_spec.rb +56 -64
  108. data/spec/integration/aws_cache_cluster_spec.rb +70 -71
  109. data/spec/integration/aws_cache_subnet_group_spec.rb +13 -14
  110. data/spec/integration/aws_cloudsearch_domain_spec.rb +6 -8
  111. data/spec/integration/aws_cloudwatch_alarm_spec.rb +200 -208
  112. data/spec/integration/aws_dhcp_options_spec.rb +32 -43
  113. data/spec/integration/aws_ebs_volume_spec.rb +52 -73
  114. data/spec/integration/aws_eip_address_spec.rb +24 -31
  115. data/spec/integration/aws_elasticsearch_domain_spec.rb +31 -33
  116. data/spec/integration/aws_iam_instance_profile_spec.rb +36 -45
  117. data/spec/integration/aws_iam_role_spec.rb +39 -46
  118. data/spec/integration/aws_internet_gateway_spec.rb +64 -75
  119. data/spec/integration/aws_key_pair_spec.rb +6 -6
  120. data/spec/integration/aws_launch_configuration_spec.rb +17 -18
  121. data/spec/integration/aws_nat_gateway_spec.rb +21 -24
  122. data/spec/integration/aws_network_acl_spec.rb +81 -95
  123. data/spec/integration/aws_network_interface_spec.rb +28 -43
  124. data/spec/integration/aws_rds_instance_spec.rb +29 -40
  125. data/spec/integration/aws_rds_parameter_group_spec.rb +32 -35
  126. data/spec/integration/aws_rds_subnet_group_spec.rb +30 -40
  127. data/spec/integration/aws_route53_hosted_zone_spec.rb +205 -205
  128. data/spec/integration/aws_route_table_spec.rb +118 -136
  129. data/spec/integration/aws_s3_bucket_spec.rb +19 -27
  130. data/spec/integration/aws_security_group_spec.rb +369 -388
  131. data/spec/integration/aws_server_certificate_spec.rb +16 -18
  132. data/spec/integration/aws_subnet_spec.rb +44 -58
  133. data/spec/integration/aws_vpc_peering_connection_spec.rb +43 -50
  134. data/spec/integration/aws_vpc_spec.rb +99 -115
  135. data/spec/integration/load_balancer_spec.rb +169 -183
  136. data/spec/integration/machine_batch_spec.rb +24 -31
  137. data/spec/integration/machine_image_spec.rb +54 -66
  138. data/spec/integration/machine_spec.rb +216 -237
  139. data/spec/persistence_file.txt +219 -0
  140. data/spec/spec_helper.rb +16 -17
  141. data/spec/unit/chef/provisioning/aws_driver/credentials_spec.rb +67 -74
  142. data/spec/unit/chef/provisioning/aws_driver/driver_spec.rb +29 -29
  143. data/spec/unit/chef/provisioning/aws_driver/route53_spec.rb +13 -15
  144. metadata +4 -3
@@ -1,87 +1,87 @@
1
- require 'chef/provisioning/aws_driver/driver'
2
- require 'chef/provisioning/aws_driver/credentials2'
1
+ require "chef/provisioning/aws_driver/driver"
2
+ require "chef/provisioning/aws_driver/credentials2"
3
3
 
4
4
  describe Chef::Provisioning::AWSDriver::Driver do
5
-
6
5
  let(:driver) { Chef::Provisioning::AWSDriver::Driver.new("aws::us-east-1", {}) }
7
- let(:aws_credentials) { double("credentials", :default => {
8
- aws_access_key_id: "id",
9
- aws_secret_access_key: "secret"
10
- })}
11
- let(:credentials2) { double("credentials2", :get_credentials => {})}
6
+ let(:aws_credentials) do
7
+ double("credentials", default: {
8
+ aws_access_key_id: "id",
9
+ aws_secret_access_key: "secret"
10
+ })
11
+ end
12
+ let(:credentials2) { double("credentials2", get_credentials: {}) }
12
13
 
13
14
  before do
14
15
  expect_any_instance_of(Chef::Provisioning::AWSDriver::Driver).to receive(:aws_credentials).and_return(aws_credentials)
15
16
  expect(Aws.config).to receive(:update) do |h|
16
- expect(h).to include({
17
+ expect(h).to include(
17
18
  access_key_id: "id",
18
19
  secret_access_key: "secret",
19
20
  region: "us-east-1"
20
- })
21
+ )
21
22
  end
22
23
  expect(Chef::Provisioning::AWSDriver::Credentials2).to receive(:new).and_return(credentials2)
23
24
  end
24
25
 
25
26
  describe "#determine_remote_host" do
26
- let(:machine_spec) { double("machine_spec", :reference => reference, :name => 'name') }
27
- let(:instance) { double("instance", :private_ip_address => 'private', :dns_name => 'dns', :public_ip_address => 'public') }
27
+ let(:machine_spec) { double("machine_spec", reference: reference, name: "name") }
28
+ let(:instance) { double("instance", private_ip_address: "private", dns_name: "dns", public_ip_address: "public") }
28
29
 
29
30
  context "when 'use_private_ip_for_ssh' is specified in the machine_spec.reference" do
30
- let(:reference) { { 'use_private_ip_for_ssh' => true } }
31
+ let(:reference) { { "use_private_ip_for_ssh" => true } }
31
32
  it "returns the private ip" do
32
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('private')
33
- expect(reference).to eq( {'transport_address_location' => :private_ip} )
33
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("private")
34
+ expect(reference).to eq("transport_address_location" => :private_ip)
34
35
  end
35
36
  end
36
37
 
37
38
  context "when 'transport_address_location' is set to :private_ip" do
38
- let(:reference) { { 'transport_address_location' => :private_ip } }
39
+ let(:reference) { { "transport_address_location" => :private_ip } }
39
40
  it "returns the private ip" do
40
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('private')
41
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("private")
41
42
  end
42
43
  end
43
44
 
44
45
  context "when 'transport_address_location' is set to :dns" do
45
- let(:reference) { { 'transport_address_location' => :dns } }
46
+ let(:reference) { { "transport_address_location" => :dns } }
46
47
  it "returns the dns name" do
47
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('dns')
48
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("dns")
48
49
  end
49
50
  end
50
51
 
51
52
  context "when 'transport_address_location' is set to :public_ip" do
52
- let(:reference) { { 'transport_address_location' => :public_ip } }
53
+ let(:reference) { { "transport_address_location" => :public_ip } }
53
54
  it "returns the public ip" do
54
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('public')
55
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("public")
55
56
  end
56
57
  end
57
58
 
58
59
  context "when machine_spec.reference does not specify the transport type" do
59
- let(:reference) { Hash.new }
60
+ let(:reference) { {} }
60
61
 
61
62
  context "when the machine does not have a public_ip_address" do
62
- let(:instance) { double("instance", :private_ip_address => 'private', :public_ip_address => nil) }
63
+ let(:instance) { double("instance", private_ip_address: "private", public_ip_address: nil) }
63
64
 
64
65
  it "returns the private ip" do
65
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('private')
66
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("private")
66
67
  end
67
68
  end
68
69
 
69
70
  context "when the machine has a public_ip_address" do
70
- let(:instance) { double("instance", :private_ip_address => 'private', :public_ip_address => 'public') }
71
+ let(:instance) { double("instance", private_ip_address: "private", public_ip_address: "public") }
71
72
 
72
73
  it "returns the public ip" do
73
- expect(driver.determine_remote_host(machine_spec, instance)).to eq('public')
74
+ expect(driver.determine_remote_host(machine_spec, instance)).to eq("public")
74
75
  end
75
76
  end
76
77
 
77
78
  context "when the machine does not have a public_ip_address or private_ip_address" do
78
- let(:instance) { double("instance", :private_ip_address => nil, :public_ip_address => nil, :id => 'id') }
79
+ let(:instance) { double("instance", private_ip_address: nil, public_ip_address: nil, id: "id") }
79
80
 
80
81
  it "raises an error" do
81
- expect {driver.determine_remote_host(machine_spec, instance)}.to raise_error("Server #{instance.id} has no private or public IP address!")
82
+ expect { driver.determine_remote_host(machine_spec, instance) }.to raise_error("Server #{instance.id} has no private or public IP address!")
82
83
  end
83
84
  end
84
85
  end
85
86
  end
86
-
87
87
  end
@@ -1,19 +1,18 @@
1
- require 'chef/provisioning/aws_driver/driver'
1
+ require "chef/provisioning/aws_driver/driver"
2
2
 
3
3
  describe ::Aws::Route53::Types::ResourceRecordSet do
4
- it "returns the correct RecordSet unique key"
4
+ it "returns the correct RecordSet unique key"
5
5
  it "returns the correct AWS change struct"
6
6
  end
7
7
 
8
8
  describe Chef::Resource::AwsRoute53RecordSet do
9
-
10
9
  let(:resource_name) { "test_resource" }
11
10
  let(:zone_name) { "blerf.net" }
12
- let(:resource) {
11
+ let(:resource) do
13
12
  r = Chef::Resource::AwsRoute53RecordSet.new(resource_name)
14
13
  r.aws_route53_zone_name(zone_name)
15
14
  r
16
- }
15
+ end
17
16
 
18
17
  it "returns the correct RecordSet unique key" do
19
18
  expect(resource.aws_key).to eq("#{resource_name}.#{zone_name}")
@@ -27,16 +26,15 @@ describe Chef::Resource::AwsRoute53RecordSet do
27
26
  resource.type("A")
28
27
  resource.resource_records(["141.222.1.1", "8.8.8.8"])
29
28
 
30
- expect(resource.to_aws_struct).to eq({ :name=>"foo.blerf.net",
31
- :type=>"A",
32
- :ttl=>900,
33
- :resource_records=>[{:value=>"141.222.1.1"}, {:value=>"8.8.8.8"}]
34
- })
29
+ expect(resource.to_aws_struct).to eq(name: "foo.blerf.net",
30
+ type: "A",
31
+ ttl: 900,
32
+ resource_records: [{ value: "141.222.1.1" }, { value: "8.8.8.8" }])
35
33
  end
36
34
 
37
35
  context "#validate_rr_type" do
38
36
  it "validates MX values" do
39
- correct = 2.times.map { [rand(10000), rand(36**40).to_s(36)].join(" ") }
37
+ correct = 2.times.map { [rand(10_000), rand(36**40).to_s(36)].join(" ") }
40
38
  expect(resource.validate_rr_type!("MX", correct)).to be_truthy
41
39
 
42
40
  incorrect = ["string content doesn't matter without a number"]
@@ -45,7 +43,7 @@ describe Chef::Resource::AwsRoute53RecordSet do
45
43
  end
46
44
 
47
45
  it "validates SRV values" do
48
- correct = 2.times.map { [rand(10000), rand(10000), rand(10000), rand(36**40).to_s(36)].join(" ") }
46
+ correct = 2.times.map { [rand(10_000), rand(10_000), rand(10_000), rand(36**40).to_s(36)].join(" ") }
49
47
  expect(resource.validate_rr_type!("MX", correct)).to be_truthy
50
48
 
51
49
  incorrect = ["string content doesn't matter without a number"]
@@ -57,7 +55,7 @@ describe Chef::Resource::AwsRoute53RecordSet do
57
55
  correct = ["foo"]
58
56
  expect(resource.validate_rr_type!("CNAME", correct)).to be_truthy
59
57
 
60
- incorrect = ["foo1", "foo2"]
58
+ incorrect = %w{foo1 foo2}
61
59
  expect { resource.validate_rr_type!("CNAME", incorrect) }.to raise_error(Chef::Exceptions::ValidationFailed,
62
60
  /CNAME records may only have a single value/)
63
61
  end
@@ -72,7 +70,7 @@ describe Chef::Resource::AwsRoute53RecordSet do
72
70
  end
73
71
 
74
72
  it "quietly accepts the remaining RR types" do
75
- %w(TXT PTR AAAA SPF).each do |type|
73
+ %w{TXT PTR AAAA SPF}.each do |type|
76
74
  expect(resource.validate_rr_type!(type, "We're not validating anything on type '#{type}'.")).to be_truthy
77
75
  end
78
76
 
@@ -102,4 +100,4 @@ describe Chef::Resource::AwsRoute53RecordSet do
102
100
  end
103
101
 
104
102
  describe Chef::Provider::AwsRoute53HostedZone do
105
- end
103
+ end
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: 3.0.4
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Ball
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-20 00:00:00.000000000 Z
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-provisioning
@@ -238,6 +238,7 @@ files:
238
238
  - spec/integration/machine_batch_spec.rb
239
239
  - spec/integration/machine_image_spec.rb
240
240
  - spec/integration/machine_spec.rb
241
+ - spec/persistence_file.txt
241
242
  - spec/spec_helper.rb
242
243
  - spec/unit/chef/provisioning/aws_driver/credentials_spec.rb
243
244
  - spec/unit/chef/provisioning/aws_driver/driver_spec.rb
@@ -262,7 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
263
  version: '0'
263
264
  requirements: []
264
265
  rubyforge_project:
265
- rubygems_version: 2.7.6
266
+ rubygems_version: 2.7.7
266
267
  signing_key:
267
268
  specification_version: 4
268
269
  summary: Provisioner for creating aws containers in Chef Provisioning.