chef-provisioning-aws 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/Rakefile +19 -10
- data/chef-provisioning-aws.gemspec +1 -0
- data/lib/chef/provider/aws_rds_instance.rb +1 -1
- data/lib/chef/provider/aws_rds_parameter_group.rb +127 -0
- data/lib/chef/provisioning/aws_driver.rb +1 -0
- data/lib/chef/provisioning/aws_driver/driver.rb +7 -0
- data/lib/chef/provisioning/aws_driver/version.rb +1 -1
- data/lib/chef/resource/aws_network_acl.rb +3 -3
- data/lib/chef/resource/aws_rds_instance.rb +3 -0
- data/lib/chef/resource/aws_rds_parameter_group.rb +37 -0
- data/spec/acceptance/aws_ebs_volume/nodes/ettores-mbp.lan.json +3 -0
- data/spec/integration/aws_ebs_volume_spec.rb +1 -1
- data/spec/integration/aws_elasticsearch_domain_spec.rb +1 -1
- data/spec/integration/aws_network_acl_spec.rb +1 -1
- data/spec/integration/aws_network_interface_spec.rb +1 -1
- data/spec/integration/aws_rds_instance_spec.rb +11 -3
- data/spec/integration/aws_rds_parameter_group_spec.rb +94 -0
- data/spec/integration/aws_rds_subnet_group_spec.rb +1 -1
- data/spec/integration/aws_route_table_spec.rb +1 -1
- data/spec/integration/aws_s3_bucket_spec.rb +4 -3
- data/spec/integration/aws_security_group_spec.rb +1 -1
- data/spec/integration/aws_subnet_spec.rb +1 -1
- data/spec/integration/aws_vpc_spec.rb +1 -1
- data/spec/integration/machine_image_spec.rb +1 -1
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aed5292d699880d31eaffbff1b415985250bb92
|
4
|
+
data.tar.gz: c6f7e4c96e7b7c1a7a28a02c336666b0f03d1aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 368067e2bc0e09bd9de87fe78c65b0c7ecfa3d55e1506783d552a77ff220dea5666c271f7f68625613b85bb9f5faef27abad62b3e9a34314b9dbe7e0a4309274
|
7
|
+
data.tar.gz: e8f0f0fa76803d7b13ab449ae4a4a50a2e254183a384efc24ada0a417a9c6e6761e6eecf2b4d55792f5bae763e74fa8105d1000d28cedb58a30a731881915f2c
|
data/README.md
CHANGED
@@ -269,7 +269,7 @@ All resources (incuding base resources like `machine`) that are taggable support
|
|
269
269
|
|
270
270
|
Some AWS objects (may EC2) view the `Name` tag as unique - it shows up in a `Name` column in the AWS console. By default we specify the `Name` tag as the resource name. This can be overridden by specifying `aws_tags {Name: 'some other name'}`.
|
271
271
|
|
272
|
-
You can remove all the tags _except_ the `Name` tag by specifying `aws_tags
|
272
|
+
You can remove all the tags _except_ the `Name` tag by specifying `aws_tags({})`.
|
273
273
|
|
274
274
|
Tag keys and values can be specified as symbols or strings but will be converted to strings before sending to AWS.
|
275
275
|
|
@@ -309,7 +309,7 @@ end
|
|
309
309
|
|
310
310
|
The `aws_tagger` method is used by the tests to assert that the object tags are correct. These methods can be encapsulated in an module for DRY purposes, as the EC2 strategy shows.
|
311
311
|
|
312
|
-
Finally, you should add 3 standard tests for taggable objects - 1) Tags can be created on a new object, 2) Tags can be updated on an existing object with tags and 3) Tags can be cleared by setting `aws_tags
|
312
|
+
Finally, you should add 3 standard tests for taggable objects - 1) Tags can be created on a new object, 2) Tags can be updated on an existing object with tags and 3) Tags can be cleared by setting `aws_tags({})`. Copy the tests from an existing spec file and modify them to support your resource. TODO make a module that copies these tests for us. Right now it is complicated by the fact that some resources have required attributes that others don't.
|
313
313
|
|
314
314
|
# Looking up AWS objects
|
315
315
|
|
data/Rakefile
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "bundler"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rspec/core/rake_task"
|
4
4
|
|
5
5
|
task :default => :spec
|
6
6
|
|
7
7
|
desc "run all non-integration specs"
|
8
8
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
-
spec.pattern =
|
9
|
+
spec.pattern = "spec/**/*_spec.rb"
|
10
10
|
# TODO add back integration tests whenever we have strategy for keys
|
11
|
-
spec.exclude_pattern =
|
11
|
+
spec.exclude_pattern = "spec/integration/**/*_spec.rb"
|
12
12
|
end
|
13
13
|
|
14
14
|
desc "run integration specs"
|
15
15
|
RSpec::Core::RakeTask.new(:integration, [:pattern]) do |spec, args|
|
16
|
-
spec.pattern = args[:pattern] ||
|
16
|
+
spec.pattern = args[:pattern] || "spec/integration/**/*_spec.rb"
|
17
17
|
spec.rspec_opts = "-b"
|
18
18
|
end
|
19
19
|
|
20
20
|
desc "run :super_slow specs (machine/machine_image)"
|
21
21
|
RSpec::Core::RakeTask.new(:super_slow, [:pattern]) do |spec, args|
|
22
|
-
spec.pattern = args[:pattern] ||
|
22
|
+
spec.pattern = args[:pattern] || "spec/integration/**/*_spec.rb"
|
23
23
|
spec.rspec_opts = "-b -t super_slow"
|
24
24
|
end
|
25
25
|
|
26
26
|
desc "run all specs, except :super_slow"
|
27
27
|
RSpec::Core::RakeTask.new(:all) do |spec|
|
28
|
-
spec.pattern =
|
28
|
+
spec.pattern = "spec/**/*_spec.rb"
|
29
29
|
end
|
30
30
|
|
31
31
|
desc "run all specs, including :super_slow"
|
@@ -42,13 +42,22 @@ task :travis, [:sub_task] do |t, args|
|
|
42
42
|
pattern = "load_balancer_spec.rb,aws_route_table_spec.rb,machine_spec.rb,aws_eip_address_spec.rb" # This is a comma seperated list
|
43
43
|
pattern = pattern.split(",").map {|p| "spec/integration/**/*#{p}"}.join(",")
|
44
44
|
else
|
45
|
-
pattern =
|
45
|
+
pattern = "spec/integration/**/*_spec.rb"
|
46
46
|
end
|
47
47
|
Rake::Task[sub_task].invoke(pattern)
|
48
48
|
end
|
49
49
|
|
50
50
|
desc "travis task for machine_image tests - these take so long to run that we only run the first test"
|
51
51
|
RSpec::Core::RakeTask.new(:machine_image) do |spec|
|
52
|
-
spec.pattern =
|
52
|
+
spec.pattern = "spec/integration/machine_image_spec.rb"
|
53
53
|
spec.rspec_opts = "-b -t super_slow -e 'machine_image can create an image in the VPC'"
|
54
54
|
end
|
55
|
+
|
56
|
+
require "github_changelog_generator/task"
|
57
|
+
|
58
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
59
|
+
config.future_release = Chef::Provisioning::AWSDriver::VERSION
|
60
|
+
config.enhancement_labels = "enhancement,Enhancement,New Feature".split(",")
|
61
|
+
config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
|
62
|
+
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog".split(",")
|
63
|
+
end
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_development_dependency 'pry'
|
28
28
|
s.add_development_dependency 'pry-byebug'
|
29
29
|
s.add_development_dependency 'pry-stack_explorer'
|
30
|
+
s.add_development_dependency 'github_changelog_generator'
|
30
31
|
|
31
32
|
s.bindir = "bin"
|
32
33
|
s.executables = %w( )
|
@@ -9,7 +9,7 @@ class Chef::Provider::AwsRdsInstance < Chef::Provisioning::AWSDriver::AWSProvide
|
|
9
9
|
REQUIRED_OPTIONS = %i(db_instance_identifier allocated_storage engine
|
10
10
|
db_instance_class master_username master_user_password)
|
11
11
|
|
12
|
-
OTHER_OPTIONS = %i(engine_version multi_az iops publicly_accessible db_name port db_subnet_group_name)
|
12
|
+
OTHER_OPTIONS = %i(engine_version multi_az iops publicly_accessible db_name port db_subnet_group_name db_parameter_group_name)
|
13
13
|
|
14
14
|
def update_aws_object(instance)
|
15
15
|
Chef::Log.warn("aws_rds_instance does not support modifying a started instance")
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'chef/provisioning/aws_driver/aws_provider'
|
2
|
+
require 'chef/provisioning/aws_driver/tagging_strategy/rds'
|
3
|
+
|
4
|
+
# inspiration taken from providers/aws_rds_subnet_group.rb
|
5
|
+
# but different enough that I'm not sure there is easy abstraction
|
6
|
+
class Chef::Provider::AwsRdsParameterGroup < Chef::Provisioning::AWSDriver::AWSProvider
|
7
|
+
include Chef::Provisioning::AWSDriver::TaggingStrategy::RDSConvergeTags
|
8
|
+
|
9
|
+
provides :aws_rds_parameter_group
|
10
|
+
|
11
|
+
def create_aws_object
|
12
|
+
converge_create_message = "create RDS parameter group #{new_resource.name} in #{region}"
|
13
|
+
if update_parameters
|
14
|
+
converge_notes = [converge_create_message, " set group parameters to #{desired_options[:parameters]}"]
|
15
|
+
else
|
16
|
+
converge_notes = converge_create_message
|
17
|
+
end
|
18
|
+
|
19
|
+
converge_by converge_notes do
|
20
|
+
driver.create_db_parameter_group(desired_create_options)
|
21
|
+
|
22
|
+
if update_parameters
|
23
|
+
driver.modify_db_parameter_group(desired_update_options)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def destroy_aws_object(_parameter_group)
|
29
|
+
converge_by "delete RDS parameter group #{new_resource.name} in #{region}" do
|
30
|
+
driver.delete_db_parameter_group(db_parameter_group_name: new_resource.name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_aws_object(_parameter_group)
|
35
|
+
updates = required_updates
|
36
|
+
if ! updates.empty?
|
37
|
+
converge_by updates do
|
38
|
+
driver.modify_db_parameter_group(desired_update_options)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def desired_create_options
|
44
|
+
result = {}
|
45
|
+
full_options = desired_options
|
46
|
+
result[:db_parameter_group_name] = full_options[:db_parameter_group_name]
|
47
|
+
result[:db_parameter_group_family] = full_options[:db_parameter_group_family]
|
48
|
+
result[:description] = full_options[:description]
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
def desired_update_options
|
53
|
+
result = {}
|
54
|
+
full_options = desired_options
|
55
|
+
result[:db_parameter_group_name] = full_options[:db_parameter_group_name]
|
56
|
+
result[:parameters] = full_options[:parameters]
|
57
|
+
result
|
58
|
+
end
|
59
|
+
|
60
|
+
def desired_options
|
61
|
+
@desired_options ||= begin
|
62
|
+
opts = {}
|
63
|
+
opts[:db_parameter_group_name] = new_resource.name
|
64
|
+
opts[:db_parameter_group_family] = new_resource.db_parameter_group_family
|
65
|
+
opts[:description] = new_resource.description
|
66
|
+
opts[:parameters] = new_resource.parameters
|
67
|
+
AWSResource.lookup_options(opts, resource: new_resource)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Given an existing parameter group, return an array of update descriptions
|
72
|
+
# representing the updates that need to be made.
|
73
|
+
#
|
74
|
+
# Also returns Chef warnings for all the fields required for create that
|
75
|
+
# are not updateable, which is currently every field but parameters :(
|
76
|
+
#
|
77
|
+
# If no updates are needed, an empty array is returned.
|
78
|
+
def required_updates
|
79
|
+
# this is the only updateable field
|
80
|
+
ret = []
|
81
|
+
if update_parameters
|
82
|
+
ret << " set group parameters to #{desired_options[:parameters]}"
|
83
|
+
end
|
84
|
+
|
85
|
+
if ! desired_options[:db_parameter_group_family].nil?
|
86
|
+
# modify_db_parameter_group doesn't support updating the db_parameter_group_family according to
|
87
|
+
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/RDS/Client.html#modify_db_parameter_group-instance_method
|
88
|
+
# which is frustrating because it is required for create
|
89
|
+
Chef::Log.warn "Updating description for RDS parameter groups is not supported by RDS client."
|
90
|
+
end
|
91
|
+
|
92
|
+
if ! desired_options[:description].nil?
|
93
|
+
# modify_db_parameter_group doesn't support updating the description according to
|
94
|
+
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/RDS/Client.html#modify_db_parameter_group-instance_method
|
95
|
+
# which is frustrating because it is required for create
|
96
|
+
Chef::Log.warn "Updating description for RDS parameter groups is not supported by RDS client."
|
97
|
+
end
|
98
|
+
|
99
|
+
if ! (desired_options[:aws_tags].nil? || desired_options[:aws_tags].empty?)
|
100
|
+
# modify_db_parameter_group doesn't support the tags key according to
|
101
|
+
# http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/RDS/Client.html#modify_db_parameter_group-instance_method
|
102
|
+
Chef::Log.warn "Updating tags for RDS parameter groups is not supported by RDS client."
|
103
|
+
end
|
104
|
+
|
105
|
+
ret.unshift("update RDS parameter group #{new_resource.name} in #{region}") unless ret.empty?
|
106
|
+
ret
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def update_parameters
|
112
|
+
# We cannot properly check for idempotence here due to errors in the RDS API's describe_db_parameters endpoint
|
113
|
+
# describe_db_parameters is supposed to return every field for every entry, but it does not return apply_method,
|
114
|
+
# which is a required field to modify_db_parameter_group.
|
115
|
+
#
|
116
|
+
# Therefore, we cannot have idempotence on users updating the value of apply_method, so we must either
|
117
|
+
# break in the case that the user specifies apply_method for a parameter and then later specified a different
|
118
|
+
# value for apply_method for that parameter later in a recipe, or not be itempotent.
|
119
|
+
#
|
120
|
+
# Breaking the user is never the right option, so we have elected to not be itempotent.
|
121
|
+
! (desired_options[:parameters].nil? || desired_options[:parameters].empty?)
|
122
|
+
end
|
123
|
+
|
124
|
+
def driver
|
125
|
+
new_resource.driver.rds.client
|
126
|
+
end
|
127
|
+
end
|
@@ -22,6 +22,7 @@ require "chef/resource/aws_network_acl"
|
|
22
22
|
require "chef/resource/aws_network_interface"
|
23
23
|
require "chef/resource/aws_rds_instance"
|
24
24
|
require "chef/resource/aws_rds_subnet_group"
|
25
|
+
require "chef/resource/aws_rds_parameter_group"
|
25
26
|
require "chef/resource/aws_route_table"
|
26
27
|
require "chef/resource/aws_route53_hosted_zone"
|
27
28
|
require "chef/resource/aws_s3_bucket"
|
@@ -844,6 +844,13 @@ EOD
|
|
844
844
|
bootstrap_options[:iam_instance_profile] = {name: bootstrap_options[:iam_instance_profile]}
|
845
845
|
end
|
846
846
|
|
847
|
+
if machine_options[:is_windows]
|
848
|
+
Chef::Log.debug "Setting Default WinRM userdata for windows..."
|
849
|
+
bootstrap_options[:user_data] = Base64.encode64(user_data) if bootstrap_options[:user_data].nil?
|
850
|
+
else
|
851
|
+
Chef::Log.debug "Non-windows, not setting userdata"
|
852
|
+
end
|
853
|
+
|
847
854
|
bootstrap_options = AWSResource.lookup_options(bootstrap_options, managed_entry_store: machine_spec.managed_entry_store, driver: self)
|
848
855
|
|
849
856
|
# In the migration from V1 to V2 we still support associate_public_ip_address at the top level
|
@@ -30,16 +30,16 @@ class Chef::Resource::AwsNetworkAcl < Chef::Provisioning::AWSDriver::AWSResource
|
|
30
30
|
#
|
31
31
|
# `cidr_block` will be a source if it is an inbound rule, or a destination if it is an outbound rule
|
32
32
|
#
|
33
|
-
# If `inbound_rules` or `outbound_rules` is
|
33
|
+
# If `inbound_rules` or `outbound_rules` is unset, respective current rules will not be changed.
|
34
34
|
# However, if either is set to `[]` all respective current rules will be removed.
|
35
35
|
#
|
36
36
|
attribute :inbound_rules,
|
37
37
|
kind_of: [ Array, Hash ],
|
38
|
-
coerce: proc { |v| [v].flatten }
|
38
|
+
coerce: proc { |v| v && [v].flatten }
|
39
39
|
|
40
40
|
attribute :outbound_rules,
|
41
41
|
kind_of: [ Array, Hash ],
|
42
|
-
coerce: proc { |v| [v].flatten }
|
42
|
+
coerce: proc { |v| v && [v].flatten }
|
43
43
|
|
44
44
|
attribute :network_acl_id,
|
45
45
|
kind_of: String,
|
@@ -22,6 +22,9 @@ class Chef::Resource::AwsRdsInstance < Chef::Provisioning::AWSDriver::AWSRDSReso
|
|
22
22
|
# We cannot pass the resource or an AWS object because there is no AWS model
|
23
23
|
# and that causes lookup_options to fail
|
24
24
|
attribute :db_subnet_group_name, kind_of: String
|
25
|
+
# We cannot pass the resource or an AWS object because there is no AWS model
|
26
|
+
# and that causes lookup_options to fail
|
27
|
+
attribute :db_parameter_group_name, kind_of: String
|
25
28
|
|
26
29
|
# RDS has a ton of options, allow users to set any of them via a
|
27
30
|
# custom Hash
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'chef/provisioning/aws_driver/aws_rds_resource'
|
2
|
+
require 'chef/provisioning/aws_driver/aws_taggable'
|
3
|
+
|
4
|
+
class Chef::Resource::AwsRdsParameterGroup < Chef::Provisioning::AWSDriver::AWSRDSResource
|
5
|
+
include Chef::Provisioning::AWSDriver::AWSTaggable
|
6
|
+
|
7
|
+
# there is no class for a parameter group specifically
|
8
|
+
aws_sdk_type AWS::RDS
|
9
|
+
|
10
|
+
attribute :name, kind_of: String, name_attribute: true
|
11
|
+
attribute :db_parameter_group_family, kind_of: String, required: true
|
12
|
+
attribute :description, kind_of: String, required: true
|
13
|
+
attribute :parameters, kind_of: Array, default: []
|
14
|
+
|
15
|
+
def aws_object
|
16
|
+
object = driver.rds.client.describe_db_parameter_groups(db_parameter_group_name: name)[:db_parameter_groups].first
|
17
|
+
|
18
|
+
# use paginated API to get all options
|
19
|
+
initial_request = driver.rds.client.describe_db_parameters(db_parameter_group_name: name, max_records: 100)
|
20
|
+
marker = initial_request[:marker]
|
21
|
+
parameters = initial_request[:parameters]
|
22
|
+
while !marker.nil?
|
23
|
+
more_results = driver.rds.client.describe_db_parameters(db_parameter_group_name: name, max_records: 100, marker: marker)
|
24
|
+
parameters += more_results[:parameters]
|
25
|
+
marker = more_results[:marker]
|
26
|
+
end
|
27
|
+
object[:parameters] = parameters
|
28
|
+
|
29
|
+
object
|
30
|
+
rescue AWS::RDS::Errors::DBParameterGroupNotFound
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def rds_tagging_type
|
35
|
+
"pg"
|
36
|
+
end
|
37
|
+
end
|
@@ -99,7 +99,7 @@ describe Chef::Resource::AwsElasticsearchDomain do
|
|
99
99
|
it "removes all aws_elasticsearch_domain tags" do
|
100
100
|
expect_recipe {
|
101
101
|
aws_elasticsearch_domain "test-#{time}-2" do
|
102
|
-
aws_tags
|
102
|
+
aws_tags({})
|
103
103
|
end
|
104
104
|
}.to have_aws_elasticsearch_domain_tags("test-#{time}-2", {}).and be_idempotent
|
105
105
|
end
|
@@ -4,7 +4,7 @@ describe Chef::Resource::AwsRdsInstance do
|
|
4
4
|
extend AWSSupport
|
5
5
|
|
6
6
|
when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
|
7
|
-
with_aws "with a connection to AWS, a VPC, two subnets, and a db
|
7
|
+
with_aws "with a connection to AWS, a VPC, two subnets, a db subnet group, and a db parameter group" do
|
8
8
|
|
9
9
|
azs = []
|
10
10
|
driver.ec2.availability_zones.each do |az|
|
@@ -35,7 +35,13 @@ describe Chef::Resource::AwsRdsInstance do
|
|
35
35
|
subnets ["test_subnet", test_subnet_2.aws_object.id]
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
aws_rds_parameter_group "test-db-parameter-group" do
|
39
|
+
db_parameter_group_family "postgres9.4"
|
40
|
+
description "testing provisioning"
|
41
|
+
parameters [{:parameter_name => "max_connections", :parameter_value => "250", :apply_method => "pending-reboot"}]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "aws_rds_instance 'test-rds-instance' creates an rds instance that can parse the aws_rds_subnet_group and aws_rds_parameter_group" do
|
39
45
|
expect_recipe {
|
40
46
|
aws_rds_instance "test-rds-instance" do
|
41
47
|
engine "postgres"
|
@@ -46,6 +52,7 @@ describe Chef::Resource::AwsRdsInstance do
|
|
46
52
|
multi_az false
|
47
53
|
allocated_storage 5
|
48
54
|
db_subnet_group_name "test-db-subnet-group"
|
55
|
+
db_parameter_group_name "test-db-parameter-group"
|
49
56
|
end
|
50
57
|
}.to create_an_aws_rds_instance('test-rds-instance',
|
51
58
|
engine: 'postgres',
|
@@ -55,6 +62,7 @@ describe Chef::Resource::AwsRdsInstance do
|
|
55
62
|
).and be_idempotent
|
56
63
|
r = driver.rds_resource.db_instance("test-rds-instance")
|
57
64
|
expect(r.db_subnet_group.db_subnet_group_name).to eq("test-db-subnet-group")
|
65
|
+
expect(r.db_parameter_groups.first.db_parameter_group_name).to eq("test-db-parameter-group")
|
58
66
|
expect(r.publicly_accessible).to eq(false)
|
59
67
|
end
|
60
68
|
|
@@ -133,7 +141,7 @@ describe Chef::Resource::AwsRdsInstance do
|
|
133
141
|
it "removes all aws_rds_instance tags" do
|
134
142
|
expect_recipe {
|
135
143
|
aws_rds_instance "test-rds-instance-tagging-#{tagging_id}" do
|
136
|
-
aws_tags
|
144
|
+
aws_tags({})
|
137
145
|
allocated_storage 5
|
138
146
|
db_instance_class "db.t1.micro"
|
139
147
|
engine "postgres"
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Chef::Resource::AwsRdsParameterGroup do
|
4
|
+
extend AWSSupport
|
5
|
+
when_the_chef_12_server "exists", organization: 'foo', server_scope: :context do
|
6
|
+
|
7
|
+
with_aws "no required pre-existing objects" do
|
8
|
+
it "creates an empty parameter group" do
|
9
|
+
expect_recipe {
|
10
|
+
aws_rds_parameter_group "test-db-parameter-group" do
|
11
|
+
db_parameter_group_family "postgres9.4"
|
12
|
+
description "testing provisioning"
|
13
|
+
end
|
14
|
+
}.to create_an_aws_rds_parameter_group("test-db-parameter-group",
|
15
|
+
:db_parameter_group_family => "postgres9.4",
|
16
|
+
:description => "testing provisioning"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "creates a parameter group with tags" do
|
21
|
+
expect_recipe {
|
22
|
+
aws_rds_parameter_group "test-db-parameter-group-with-tags" do
|
23
|
+
db_parameter_group_family "postgres9.4"
|
24
|
+
description "testing provisioning"
|
25
|
+
aws_tags key1: 'value'
|
26
|
+
end
|
27
|
+
}.to create_an_aws_rds_parameter_group("test-db-parameter-group-with-tags")
|
28
|
+
.and have_aws_rds_parameter_group_tags("test-db-parameter-group-with-tags",
|
29
|
+
{
|
30
|
+
'key1' => 'value'
|
31
|
+
}
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "creates an new parameter group with parameters" do
|
36
|
+
results = nil
|
37
|
+
expect_recipe {
|
38
|
+
results = aws_rds_parameter_group "test-db-parameter-group-with-parameters" do
|
39
|
+
db_parameter_group_family "postgres9.4"
|
40
|
+
description "testing provisioning"
|
41
|
+
parameters [{:parameter_name => "max_connections", :parameter_value => "250", :apply_method => "pending-reboot"}]
|
42
|
+
end
|
43
|
+
}.to create_an_aws_rds_parameter_group("test-db-parameter-group-with-parameters",
|
44
|
+
:db_parameter_group_family => "postgres9.4",
|
45
|
+
:description => "testing provisioning",
|
46
|
+
)
|
47
|
+
|
48
|
+
expect(results.parameters).to eq([{:parameter_name => "max_connections", :parameter_value => "250", :apply_method => "pending-reboot"}])
|
49
|
+
|
50
|
+
results.aws_object[:parameters].each do |parameter|
|
51
|
+
expect(parameter[:parameter_value]).to eq("250") if parameter[:parameter_name] == "max_connections"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when the object is updated" do
|
56
|
+
let(:final_max_connection_value) { "300" }
|
57
|
+
let(:final_application_name_value) { "second_name" }
|
58
|
+
let(:initial_parameters) { [
|
59
|
+
{:parameter_name => "application_name", :parameter_value => "first_name", :apply_method => "pending-reboot"}
|
60
|
+
] }
|
61
|
+
let(:updated_parameters) { [
|
62
|
+
{:parameter_name => "application_name", :parameter_value => final_application_name_value, :apply_method => "pending-reboot"},
|
63
|
+
{:parameter_name => "max_connections", :parameter_value => final_max_connection_value, :apply_method => "pending-reboot"}
|
64
|
+
] }
|
65
|
+
it "updates properly" do
|
66
|
+
results = nil
|
67
|
+
expect_recipe {
|
68
|
+
results = aws_rds_parameter_group "test-db-parameter-group-updated" do
|
69
|
+
db_parameter_group_family "postgres9.4"
|
70
|
+
description "testing provisioning"
|
71
|
+
parameters initial_parameters
|
72
|
+
end
|
73
|
+
}
|
74
|
+
expect(results.parameters).to eq(initial_parameters)
|
75
|
+
|
76
|
+
results_2 = nil
|
77
|
+
expect_recipe {
|
78
|
+
results_2 = aws_rds_parameter_group "test-db-parameter-group-updated" do
|
79
|
+
db_parameter_group_family "postgres9.4"
|
80
|
+
description "testing provisioning"
|
81
|
+
parameters updated_parameters
|
82
|
+
end
|
83
|
+
}
|
84
|
+
expect(results_2.parameters).to eq(updated_parameters)
|
85
|
+
results_2.aws_object[:parameters].each do |parameter|
|
86
|
+
expect(parameter[:parameter_value]).to eq(final_max_connection_value) if parameter[:parameter_name] == "max_connections"
|
87
|
+
expect(parameter[:parameter_value]).to eq(final_application_name_value) if parameter[:parameter_name] == "application_name"
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -93,7 +93,7 @@ describe Chef::Resource::AwsRdsSubnetGroup do
|
|
93
93
|
aws_rds_subnet_group "test-db-subnet-group" do
|
94
94
|
description "some_description"
|
95
95
|
subnets ["test_subnet", test_subnet_2.aws_object.id]
|
96
|
-
aws_tags
|
96
|
+
aws_tags({})
|
97
97
|
end
|
98
98
|
}.to have_aws_rds_subnet_group_tags("test-db-subnet-group", {}
|
99
99
|
).and be_idempotent
|
@@ -51,12 +51,13 @@ describe Chef::Resource::AwsS3Bucket do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
it "removes all aws_s3_bucket tags" do
|
54
|
+
pending
|
55
|
+
|
54
56
|
expect_recipe {
|
55
57
|
aws_s3_bucket bucket_name do
|
56
|
-
aws_tags
|
58
|
+
aws_tags({})
|
57
59
|
end
|
58
|
-
}.to have_aws_s3_bucket_tags(bucket_name, {}
|
59
|
-
).and be_idempotent
|
60
|
+
}.to have_aws_s3_bucket_tags(bucket_name, {}).and be_idempotent
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -119,7 +119,7 @@ describe Chef::Resource::MachineImage do
|
|
119
119
|
it "removes all aws_image tags", :super_slow do
|
120
120
|
expect_recipe {
|
121
121
|
machine_image 'test_machine_image' do
|
122
|
-
aws_tags
|
122
|
+
aws_tags({})
|
123
123
|
end
|
124
124
|
}.to have_aws_image_tags('test_machine_image',
|
125
125
|
{}
|
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.
|
4
|
+
version: 1.8.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:
|
11
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-provisioning
|
@@ -196,6 +196,20 @@ dependencies:
|
|
196
196
|
- - ">="
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
|
+
- !ruby/object:Gem::Dependency
|
200
|
+
name: github_changelog_generator
|
201
|
+
requirement: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
type: :development
|
207
|
+
prerelease: false
|
208
|
+
version_requirements: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - ">="
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: '0'
|
199
213
|
description: Provisioner for creating aws containers in Chef Provisioning.
|
200
214
|
email: jewart@getchef.com
|
201
215
|
executables: []
|
@@ -229,6 +243,7 @@ files:
|
|
229
243
|
- lib/chef/provider/aws_network_acl.rb
|
230
244
|
- lib/chef/provider/aws_network_interface.rb
|
231
245
|
- lib/chef/provider/aws_rds_instance.rb
|
246
|
+
- lib/chef/provider/aws_rds_parameter_group.rb
|
232
247
|
- lib/chef/provider/aws_rds_subnet_group.rb
|
233
248
|
- lib/chef/provider/aws_route_table.rb
|
234
249
|
- lib/chef/provider/aws_s3_bucket.rb
|
@@ -279,6 +294,7 @@ files:
|
|
279
294
|
- lib/chef/resource/aws_network_acl.rb
|
280
295
|
- lib/chef/resource/aws_network_interface.rb
|
281
296
|
- lib/chef/resource/aws_rds_instance.rb
|
297
|
+
- lib/chef/resource/aws_rds_parameter_group.rb
|
282
298
|
- lib/chef/resource/aws_rds_subnet_group.rb
|
283
299
|
- lib/chef/resource/aws_route53_hosted_zone.rb
|
284
300
|
- lib/chef/resource/aws_route53_record_set.rb
|
@@ -291,6 +307,7 @@ files:
|
|
291
307
|
- lib/chef/resource/aws_subnet.rb
|
292
308
|
- lib/chef/resource/aws_vpc.rb
|
293
309
|
- lib/chef/resource/aws_vpc_peering_connection.rb
|
310
|
+
- spec/acceptance/aws_ebs_volume/nodes/ettores-mbp.lan.json
|
294
311
|
- spec/aws_support.rb
|
295
312
|
- spec/aws_support/aws_resource_run_wrapper.rb
|
296
313
|
- spec/aws_support/deep_matcher.rb
|
@@ -318,6 +335,7 @@ files:
|
|
318
335
|
- spec/integration/aws_network_acl_spec.rb
|
319
336
|
- spec/integration/aws_network_interface_spec.rb
|
320
337
|
- spec/integration/aws_rds_instance_spec.rb
|
338
|
+
- spec/integration/aws_rds_parameter_group_spec.rb
|
321
339
|
- spec/integration/aws_rds_subnet_group_spec.rb
|
322
340
|
- spec/integration/aws_route53_hosted_zone_spec.rb
|
323
341
|
- spec/integration/aws_route_table_spec.rb
|
@@ -354,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
372
|
version: '0'
|
355
373
|
requirements: []
|
356
374
|
rubyforge_project:
|
357
|
-
rubygems_version: 2.4.
|
375
|
+
rubygems_version: 2.4.5.1
|
358
376
|
signing_key:
|
359
377
|
specification_version: 4
|
360
378
|
summary: Provisioner for creating aws containers in Chef Provisioning.
|