chef-provisioning-aws 3.0.4 → 3.0.6
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.
- 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,11 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource_with_entry"
|
2
2
|
|
3
3
|
class Chef::Resource::AwsEipAddress < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
4
|
-
aws_sdk_type ::Aws::OpsWorks::Types::ElasticIp, option_names: [
|
4
|
+
aws_sdk_type ::Aws::OpsWorks::Types::ElasticIp, option_names: [:public_ip], id: :public_ip, managed_entry_id_name: "public_ip", backcompat_data_bag_name: "eip_addresses"
|
5
5
|
|
6
6
|
attribute :name, kind_of: String, name_attribute: true
|
7
7
|
|
8
|
-
# TODO network interface
|
8
|
+
# TODO: network interface
|
9
9
|
attribute :machine, kind_of: [String, FalseClass]
|
10
10
|
attribute :associate_to_vpc, kind_of: [TrueClass, FalseClass]
|
11
11
|
|
@@ -22,9 +22,9 @@ class Chef::Resource::AwsEipAddress < Chef::Provisioning::AWSDriver::AWSResource
|
|
22
22
|
|
23
23
|
def action(*args)
|
24
24
|
# Backcompat for associate and disassociate
|
25
|
-
if args == [
|
25
|
+
if args == [:associate]
|
26
26
|
super(:create)
|
27
|
-
elsif args == [
|
27
|
+
elsif args == [:disassociate]
|
28
28
|
machine false
|
29
29
|
super(:create)
|
30
30
|
else
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
2
|
|
3
3
|
module AWS
|
4
4
|
class Elasticsearch
|
@@ -24,7 +24,7 @@ class Chef::Resource::AwsElasticsearchDomain < Chef::Provisioning::AWSDriver::AW
|
|
24
24
|
|
25
25
|
# EBS Options
|
26
26
|
attribute :ebs_enabled, kind_of: [TrueClass, FalseClass]
|
27
|
-
attribute :volume_type, equal_to:
|
27
|
+
attribute :volume_type, equal_to: %w{standard gp2 io1}
|
28
28
|
attribute :volume_size, kind_of: Integer
|
29
29
|
attribute :iops, kind_of: Integer
|
30
30
|
|
@@ -36,7 +36,7 @@ class Chef::Resource::AwsElasticsearchDomain < Chef::Provisioning::AWSDriver::AW
|
|
36
36
|
|
37
37
|
def aws_object
|
38
38
|
driver.elasticsearch_client
|
39
|
-
|
40
|
-
|
39
|
+
.describe_elasticsearch_domains(domain_names: [domain_name])[:domain_status_list]
|
40
|
+
.find { |d| !d[:deleted] }
|
41
41
|
end
|
42
42
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
2
|
|
3
3
|
#
|
4
4
|
# An AWS IAM instance profile, a container for an IAM role that you can use to
|
@@ -13,23 +13,22 @@ require 'chef/provisioning/aws_driver/aws_resource'
|
|
13
13
|
class Chef::Resource::AwsIamInstanceProfile < Chef::Provisioning::AWSDriver::AWSResource
|
14
14
|
# We don't want any lookup_options to try and build a resource from a :iam_instance_profile string,
|
15
15
|
# its either a name or an ARN
|
16
|
-
aws_sdk_type ::Aws::IAM::InstanceProfile, :
|
16
|
+
aws_sdk_type ::Aws::IAM::InstanceProfile, option_names: []
|
17
17
|
|
18
18
|
#
|
19
19
|
# The name of the instance profile to create.
|
20
20
|
#
|
21
|
-
attribute :name,
|
21
|
+
attribute :name, kind_of: String, name_attribute: true
|
22
22
|
|
23
23
|
#
|
24
24
|
# The path to the instance profile. For more information about paths, see http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html
|
25
25
|
#
|
26
26
|
attribute :path, kind_of: String
|
27
27
|
|
28
|
-
attribute :role, kind_of: [
|
28
|
+
attribute :role, kind_of: [String, AwsIamRole, ::Aws::IAM::Role]
|
29
29
|
|
30
30
|
def aws_object
|
31
31
|
result = driver.iam_resource.instance_profile(name)
|
32
32
|
result && result.exists? ? result : nil
|
33
33
|
end
|
34
|
-
|
35
34
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
2
|
|
3
3
|
#
|
4
4
|
# An AWS IAM role, specifying set of policies for acessing other AWS services.
|
@@ -37,7 +37,7 @@ class Chef::Resource::AwsIamRole < Chef::Provisioning::AWSDriver::AWSResource
|
|
37
37
|
#
|
38
38
|
attribute :inline_policies, kind_of: Hash, callbacks: {
|
39
39
|
"inline_policies must be a hash maping policy names to policy documents" => proc do |policies|
|
40
|
-
policies.all? {|policy_name, policy| (policy_name.is_a?(String) || policy_name.is_a?(Symbol)) && policy.is_a?(String)}
|
40
|
+
policies.all? { |policy_name, policy| (policy_name.is_a?(String) || policy_name.is_a?(Symbol)) && policy.is_a?(String) }
|
41
41
|
end
|
42
42
|
}
|
43
43
|
|
@@ -51,5 +51,4 @@ class Chef::Resource::AwsIamRole < Chef::Provisioning::AWSDriver::AWSResource
|
|
51
51
|
rescue ::Aws::IAM::Errors::NoSuchEntity
|
52
52
|
nil
|
53
53
|
end
|
54
|
-
|
55
54
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource_with_entry"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
3
|
|
4
4
|
class Chef::Resource::AwsImage < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
5
5
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
6
6
|
|
7
7
|
aws_sdk_type ::Aws::EC2::Image,
|
8
8
|
managed_entry_type: :machine_image,
|
9
|
-
managed_entry_id_name:
|
9
|
+
managed_entry_id_name: "image_id"
|
10
10
|
|
11
11
|
attribute :name, kind_of: String, name_attribute: true
|
12
12
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource_with_entry"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
3
|
|
4
4
|
class Chef::Resource::AwsInstance < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
5
5
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -7,8 +7,8 @@ class Chef::Resource::AwsInstance < Chef::Provisioning::AWSDriver::AWSResourceWi
|
|
7
7
|
# The require needs to be inside this class otherwise it gets loaded before the rest of the SDK
|
8
8
|
# and starts causing issues - AWS expects to load all this stuff itself
|
9
9
|
aws_sdk_type ::Aws::EC2::Instance,
|
10
|
-
|
11
|
-
|
10
|
+
managed_entry_type: :machine,
|
11
|
+
managed_entry_id_name: "instance_id"
|
12
12
|
|
13
13
|
attribute :name, kind_of: String, name_attribute: true
|
14
14
|
|
@@ -14,7 +14,7 @@ class Chef::Resource::AwsInternetGateway < Chef::Provisioning::AWSDriver::AWSRes
|
|
14
14
|
|
15
15
|
aws_sdk_type ::Aws::EC2::InternetGateway, id: :id
|
16
16
|
|
17
|
-
require
|
17
|
+
require "chef/resource/aws_vpc"
|
18
18
|
|
19
19
|
#
|
20
20
|
# Extend actions for the internet gateway
|
@@ -34,7 +34,7 @@ class Chef::Resource::AwsInternetGateway < Chef::Provisioning::AWSDriver::AWSRes
|
|
34
34
|
# - An actual `aws_vpc` resource.
|
35
35
|
# - An AWS `VPC` object.
|
36
36
|
#
|
37
|
-
attribute :vpc, kind_of: [
|
37
|
+
attribute :vpc, kind_of: [String, AwsVpc, ::Aws::EC2::Vpc]
|
38
38
|
|
39
39
|
attribute :internet_gateway_id, kind_of: String, aws_id_attribute: true, default: lazy {
|
40
40
|
name =~ /^igw-[a-f0-9]+$/ ? name : nil
|
@@ -50,6 +50,6 @@ class Chef::Resource::AwsInternetGateway < Chef::Provisioning::AWSDriver::AWSRes
|
|
50
50
|
def exists?(result)
|
51
51
|
return true if result.data
|
52
52
|
rescue ::Aws::EC2::Errors::InvalidInternetGatewayIDNotFound
|
53
|
-
|
53
|
+
false
|
54
54
|
end
|
55
55
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
2
|
|
3
3
|
class Chef::Resource::AwsKeyPair < Chef::Provisioning::AWSDriver::AWSResource
|
4
4
|
aws_sdk_type ::Aws::EC2::KeyPair, id: :name
|
5
5
|
|
6
6
|
# Private key to use as input (will be generated if it does not exist)
|
7
|
-
attribute :private_key_path, :
|
7
|
+
attribute :private_key_path, kind_of: String
|
8
8
|
# Public key to use as input (will be generated if it does not exist)
|
9
|
-
attribute :public_key_path, :
|
9
|
+
attribute :public_key_path, kind_of: String
|
10
10
|
# List of parameters to the private_key resource used for generation of the key
|
11
|
-
attribute :private_key_options, :
|
11
|
+
attribute :private_key_options, kind_of: Hash
|
12
12
|
|
13
|
-
# TODO what is the right default for this?
|
14
|
-
attribute :allow_overwrite, :
|
13
|
+
# TODO: what is the right default for this?
|
14
|
+
attribute :allow_overwrite, kind_of: [TrueClass, FalseClass], default: false
|
15
15
|
|
16
16
|
def aws_object
|
17
17
|
resource = ::Aws::EC2::Resource.new(driver.ec2)
|
18
|
-
result = resource.key_pairs.find{|b| b.name==name}
|
18
|
+
result = resource.key_pairs.find { |b| b.name == name }
|
19
19
|
result
|
20
20
|
end
|
21
21
|
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
2
|
|
3
3
|
class Chef::Resource::AwsLaunchConfiguration < Chef::Provisioning::AWSDriver::AWSResource
|
4
4
|
aws_sdk_type ::Aws::AutoScaling::LaunchConfiguration, id: :name
|
5
5
|
|
6
6
|
attribute :name, kind_of: String, name_attribute: true
|
7
|
-
attribute :image, kind_of: [
|
7
|
+
attribute :image, kind_of: [String, ::Aws::EC2::Image, ::Aws::EC2::Image]
|
8
8
|
attribute :instance_type, kind_of: String
|
9
|
-
attribute :options, kind_of: Hash,
|
9
|
+
attribute :options, kind_of: Hash, default: {}
|
10
10
|
|
11
11
|
def aws_object
|
12
|
-
launchconfig = ::Aws::AutoScaling::LaunchConfiguration.new(name,
|
12
|
+
launchconfig = ::Aws::AutoScaling::LaunchConfiguration.new(name, client: driver.auto_scaling_client)
|
13
13
|
result = launchconfig.data
|
14
14
|
result
|
15
15
|
end
|
@@ -1,30 +1,30 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
3
|
|
4
4
|
class Chef::Resource::AwsLoadBalancer < Chef::Provisioning::AWSDriver::AWSResource
|
5
5
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
6
6
|
|
7
7
|
aws_sdk_type ::Aws::AutoScaling::LoadBalancer
|
8
8
|
|
9
|
-
attribute :name, kind_of: String,
|
9
|
+
attribute :name, kind_of: String, name_attribute: true
|
10
10
|
|
11
11
|
attribute :load_balancer_id, kind_of: String, aws_id_attribute: true, default: lazy {
|
12
12
|
name =~ /^elb-[a-f0-9]+$/ ? name : nil
|
13
13
|
}
|
14
14
|
|
15
15
|
def aws_object
|
16
|
-
result=nil
|
16
|
+
result = nil
|
17
17
|
begin
|
18
|
-
result = driver.elb.describe_load_balancers(
|
18
|
+
result = driver.elb.describe_load_balancers(load_balancer_names: [name]).load_balancer_descriptions
|
19
19
|
if result.length == 1
|
20
20
|
result = result[0]
|
21
21
|
else
|
22
22
|
raise "Must have 0 or 1 load balancers which match name!"
|
23
23
|
end
|
24
|
-
rescue ::Aws::ElasticLoadBalancing::Errors::LoadBalancerNotFound
|
24
|
+
rescue ::Aws::ElasticLoadBalancing::Errors::LoadBalancerNotFound
|
25
25
|
Chef::Log.debug("No loadbalancer named #{name} - returning nil!")
|
26
26
|
result = nil
|
27
|
-
end
|
27
|
+
end
|
28
28
|
result
|
29
29
|
end
|
30
30
|
end
|
@@ -33,33 +33,33 @@ class Aws::EC2::NatGateway < ::Aws::Resources::Resource
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def delete
|
36
|
-
@client.delete_nat_gateway(
|
36
|
+
@client.delete_nat_gateway(nat_gateway_id: @id)
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
40
|
+
|
40
41
|
def get_nat_gateway_struct
|
41
|
-
@client.describe_nat_gateways(
|
42
|
+
@client.describe_nat_gateways(nat_gateway_ids: [@id]).nat_gateways.first
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
46
|
# See comment on class above as to why we add these methods to the AWS SDK
|
46
47
|
class Aws::EC2::Resource
|
47
48
|
def create_nat_gateway(options)
|
48
|
-
nat_gateway_struct =
|
49
|
-
|
49
|
+
nat_gateway_struct = client.create_nat_gateway(options).nat_gateway
|
50
|
+
nat_gateway(nat_gateway_struct.nat_gateway_id)
|
50
51
|
end
|
51
52
|
|
52
53
|
def nat_gateway(nat_gateway_id)
|
53
|
-
::Aws::EC2::NatGateway.new(nat_gateway_id,
|
54
|
+
::Aws::EC2::NatGateway.new(nat_gateway_id, client: client)
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
57
58
|
class Chef::Resource::AwsNatGateway < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
59
|
+
aws_sdk_type ::Aws::EC2::NatGateway, id: :nat_gateway_id, managed_entry_id_name: "nat_gateway_id"
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
require 'chef/resource/aws_subnet'
|
62
|
-
require 'chef/resource/aws_eip_address'
|
61
|
+
require "chef/resource/aws_subnet"
|
62
|
+
require "chef/resource/aws_eip_address"
|
63
63
|
|
64
64
|
#
|
65
65
|
# The name of this nat gateway.
|
@@ -74,7 +74,7 @@ class Chef::Resource::AwsNatGateway < Chef::Provisioning::AWSDriver::AWSResource
|
|
74
74
|
# - An actual `aws_subnet` resource.
|
75
75
|
# - An Aws `Subnet` object.
|
76
76
|
#
|
77
|
-
attribute :subnet, kind_of: [
|
77
|
+
attribute :subnet, kind_of: [String, AwsSubnet, ::Aws::EC2::Subnet]
|
78
78
|
|
79
79
|
#
|
80
80
|
# A elastic ip address for the nat gateway.
|
@@ -84,7 +84,7 @@ class Chef::Resource::AwsNatGateway < Chef::Provisioning::AWSDriver::AWSResource
|
|
84
84
|
# - An actual `aws_eip_address` resource.
|
85
85
|
# - nil, meaning that no EIP exists yet and needs to be created.
|
86
86
|
#
|
87
|
-
attribute :eip_address, kind_of: [
|
87
|
+
attribute :eip_address, kind_of: [String, ::Aws::OpsWorks::Types::ElasticIp, AwsEipAddress, nil], default: nil
|
88
88
|
|
89
89
|
attribute :nat_gateway_id, kind_of: String, aws_id_attribute: true, default: lazy {
|
90
90
|
name =~ /^nat-[A-Fa-f0-9]+$/ ? name : nil
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource_with_entry"
|
2
|
+
require "chef/resource/aws_vpc"
|
3
|
+
require "chef/resource/aws_subnet"
|
4
4
|
|
5
5
|
class Chef::Resource::AwsNetworkAcl < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
6
6
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -20,7 +20,7 @@ class Chef::Resource::AwsNetworkAcl < Chef::Provisioning::AWSDriver::AWSResource
|
|
20
20
|
# - An actual `aws_vpc` resource.
|
21
21
|
# - An AWS `VPC` object.
|
22
22
|
#
|
23
|
-
attribute :vpc, kind_of: [
|
23
|
+
attribute :vpc, kind_of: [String, AwsVpc, ::Aws::EC2::Vpc]
|
24
24
|
|
25
25
|
#
|
26
26
|
# Accepts rules in the format:
|
@@ -34,11 +34,11 @@ class Chef::Resource::AwsNetworkAcl < Chef::Provisioning::AWSDriver::AWSResource
|
|
34
34
|
# However, if either is set to `[]` all respective current rules will be removed.
|
35
35
|
#
|
36
36
|
attribute :inbound_rules,
|
37
|
-
kind_of: [
|
37
|
+
kind_of: [Array, Hash],
|
38
38
|
coerce: proc { |v| v && [v].flatten }
|
39
39
|
|
40
40
|
attribute :outbound_rules,
|
41
|
-
kind_of: [
|
41
|
+
kind_of: [Array, Hash],
|
42
42
|
coerce: proc { |v| v && [v].flatten }
|
43
43
|
|
44
44
|
attribute :network_acl_id,
|
@@ -57,7 +57,6 @@ class Chef::Resource::AwsNetworkAcl < Chef::Provisioning::AWSDriver::AWSResource
|
|
57
57
|
def exists?(result)
|
58
58
|
return true if result.data
|
59
59
|
rescue ::Aws::EC2::Errors::InvalidNetworkAclIDNotFound
|
60
|
-
|
60
|
+
false
|
61
61
|
end
|
62
|
-
|
63
62
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_resource"
|
2
|
+
require "chef/resource/aws_subnet"
|
3
|
+
require "chef/resource/aws_eip_address"
|
4
4
|
|
5
5
|
class Chef::Resource::AwsNetworkInterface < Chef::Provisioning::AWSDriver::AWSResourceWithEntry
|
6
6
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -13,20 +13,20 @@ class Chef::Resource::AwsNetworkInterface < Chef::Provisioning::AWSDriver::AWSRe
|
|
13
13
|
name =~ /^eni-[a-f0-9]+$/ ? name : nil
|
14
14
|
}
|
15
15
|
|
16
|
-
attribute :subnet, kind_of: [
|
16
|
+
attribute :subnet, kind_of: [String, ::Aws::EC2::Subnet, AwsSubnet]
|
17
17
|
|
18
18
|
attribute :private_ip_address, kind_of: String
|
19
19
|
|
20
20
|
attribute :description, kind_of: String
|
21
21
|
|
22
|
-
attribute :security_groups, kind_of: Array #(Array<SecurityGroup>, Array<String>)
|
22
|
+
attribute :security_groups, kind_of: Array # (Array<SecurityGroup>, Array<String>)
|
23
23
|
|
24
|
-
attribute :machine, kind_of: [
|
24
|
+
attribute :machine, kind_of: [String, FalseClass, AwsInstance, ::Aws::EC2::Instance, ::Aws::EC2::Instance]
|
25
25
|
|
26
26
|
attribute :device_index, kind_of: Integer
|
27
27
|
|
28
|
-
# TODO implement eip address association
|
29
|
-
#attribute :elastic_ip_address, kind_of: [ String, ::Aws::OpsWorks::Types::ElasticIp, AwsEipAddress, FalseClass ]
|
28
|
+
# TODO: implement eip address association
|
29
|
+
# attribute :elastic_ip_address, kind_of: [ String, ::Aws::OpsWorks::Types::ElasticIp, AwsEipAddress, FalseClass ]
|
30
30
|
|
31
31
|
def aws_object
|
32
32
|
driver, id = get_driver_and_id
|
@@ -37,6 +37,6 @@ class Chef::Resource::AwsNetworkInterface < Chef::Provisioning::AWSDriver::AWSRe
|
|
37
37
|
def exists?(result)
|
38
38
|
return true if result.data
|
39
39
|
rescue ::Aws::EC2::Errors::InvalidNetworkInterfaceIDNotFound
|
40
|
-
|
40
|
+
false
|
41
41
|
end
|
42
42
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_rds_resource"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
3
|
|
4
4
|
class Chef::Resource::AwsRdsInstance < Chef::Provisioning::AWSDriver::AWSRDSResource
|
5
5
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -32,8 +32,8 @@ class Chef::Resource::AwsRdsInstance < Chef::Provisioning::AWSDriver::AWSRDSReso
|
|
32
32
|
attribute :additional_options, kind_of: Hash, default: {}
|
33
33
|
|
34
34
|
def aws_object
|
35
|
-
result =
|
36
|
-
return nil unless result && result.db_instance_status !=
|
35
|
+
result = driver.rds_resource.db_instance(name)
|
36
|
+
return nil unless result && result.db_instance_status != "deleting"
|
37
37
|
result
|
38
38
|
rescue ::Aws::RDS::Errors::DBInstanceNotFound
|
39
39
|
nil
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_rds_resource"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
3
|
|
4
4
|
class Chef::Resource::AwsRdsParameterGroup < Chef::Provisioning::AWSDriver::AWSRDSResource
|
5
5
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -19,7 +19,7 @@ class Chef::Resource::AwsRdsParameterGroup < Chef::Provisioning::AWSDriver::AWSR
|
|
19
19
|
initial_request = driver.rds.describe_db_parameters(db_parameter_group_name: name, max_records: 100)
|
20
20
|
marker = initial_request[:marker]
|
21
21
|
parameters = initial_request[:parameters]
|
22
|
-
|
22
|
+
until marker.nil?
|
23
23
|
more_results = driver.rds.describe_db_parameters(db_parameter_group_name: name, max_records: 100, marker: marker)
|
24
24
|
parameters += more_results[:parameters]
|
25
25
|
marker = more_results[:marker]
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "chef/provisioning/aws_driver/aws_rds_resource"
|
2
|
+
require "chef/provisioning/aws_driver/aws_taggable"
|
3
|
+
require "chef/resource/aws_subnet"
|
4
4
|
|
5
5
|
class Chef::Resource::AwsRdsSubnetGroup < Chef::Provisioning::AWSDriver::AWSRDSResource
|
6
6
|
include Chef::Provisioning::AWSDriver::AWSTaggable
|
@@ -10,7 +10,7 @@ class Chef::Resource::AwsRdsSubnetGroup < Chef::Provisioning::AWSDriver::AWSRDSR
|
|
10
10
|
attribute :name, kind_of: String, name_attribute: true
|
11
11
|
attribute :description, kind_of: String, required: true
|
12
12
|
attribute :subnets,
|
13
|
-
kind_of: [
|
13
|
+
kind_of: [String, Array, AwsSubnet, ::Aws::EC2::Subnet],
|
14
14
|
required: true,
|
15
15
|
coerce: proc { |v| [v].flatten }
|
16
16
|
|