hiera-aws 0.0.5 → 0.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/.rubocop.yml +17 -0
- data/.travis.yml +2 -4
- data/README.md +31 -7
- data/Rakefile +6 -1
- data/hiera-aws.gemspec +1 -0
- data/lib/hiera/backend/aws/base.rb +12 -2
- data/lib/hiera/backend/aws/elasticache.rb +9 -13
- data/lib/hiera/backend/aws/rds.rb +57 -0
- data/lib/hiera/backend/aws/version.rb +2 -2
- data/lib/hiera/backend/aws_backend.rb +9 -5
- data/spec/aws_backend_spec.rb +7 -1
- data/spec/aws_base_spec.rb +32 -3
- data/spec/aws_elasticache_spec.rb +50 -42
- data/spec/aws_rds_spec.rb +83 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56537b23031d0700addcb408d1d47fd3a1eecd2e
|
4
|
+
data.tar.gz: e672330d9bf693caa50207dab7e0ce371a8d70db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1121e5a75df9263b4654cd2ba82da332d078550bfb538b7819e588d5615cb19f85e9043bf7a84b2450d922000bfb1e4d958602e0dd1c94924ab74ad6b422b254
|
7
|
+
data.tar.gz: 4b6b9056a6173ab307fd55470a92793bd501b5f9c6b0ad70e87230093432fec1ec2c65cfcbd01ad386455e855bdca1d62c5d108ce0d73d9bd240f38f79d8e1ee
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -25,18 +25,25 @@ First, add the backend to the list of backends in `hiera.yaml`:
|
|
25
25
|
- aws
|
26
26
|
```
|
27
27
|
|
28
|
-
Next, add
|
29
|
-
service currently supported by this backend.
|
28
|
+
Next, add the AWS services supported by this backend to the hierarchy:
|
30
29
|
|
31
30
|
```yaml
|
32
31
|
:hierarchy:
|
33
32
|
- aws/elasticache
|
33
|
+
- aws/rds
|
34
34
|
```
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
The following AWS privileges are required for Hiera to work:
|
37
|
+
|
38
|
+
- `AmazonEC2ReadOnlyAccess`
|
39
|
+
- `AmazonElastiCacheReadOnlyAccess`
|
40
|
+
- `AmazonRDSReadOnlyAccess`
|
41
|
+
- `AWSCloudFormationReadOnlyAccess`
|
42
|
+
- `IAMReadOnlyAccess`
|
43
|
+
|
44
|
+
To grant those privileges, you either have to assign the EC2 instances an IAM
|
45
|
+
role (preferred) or provide credentials for a user with the same privileges via
|
46
|
+
the backend configuration in `hiera.yml`:
|
40
47
|
|
41
48
|
```yaml
|
42
49
|
:aws:
|
@@ -44,7 +51,6 @@ backend configuration in `hiera.yml`:
|
|
44
51
|
:secret_access_key: your_aws_secret_access_key_here
|
45
52
|
```
|
46
53
|
|
47
|
-
|
48
54
|
## Hiera Keys
|
49
55
|
|
50
56
|
The backend currently supports the following keys that you can pass to the
|
@@ -89,6 +95,24 @@ Usage:
|
|
89
95
|
cluster_nodes = hiera("memcached_cluster_nodes_for_cfn_stack")
|
90
96
|
```
|
91
97
|
|
98
|
+
### rds tag=value...
|
99
|
+
|
100
|
+
Returns an array of all RDS database instances that have one or more tags. The
|
101
|
+
returned array has the format `["host1", "host2"]`.
|
102
|
+
|
103
|
+
Usage:
|
104
|
+
|
105
|
+
```
|
106
|
+
# Get all database instances
|
107
|
+
rds_instances = hiera("rds")
|
108
|
+
|
109
|
+
# Get all database instances that have a tag named "environment" with the value "dev"
|
110
|
+
rds_instances = hiera("rds environment=dev")
|
111
|
+
|
112
|
+
# Get all database instances that have two specific tags
|
113
|
+
rds_instances = hiera("rds environment=production role=mgmt-db")
|
114
|
+
```
|
115
|
+
|
92
116
|
## License and Authors
|
93
117
|
|
94
118
|
* Author:: Mathias Lafeldt (mathias.lafeldt@jimdo.com)
|
data/Rakefile
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
|
+
require "rubocop/rake_task"
|
4
|
+
|
5
|
+
desc "Run RuboCop style and lint checks"
|
6
|
+
Rubocop::RakeTask.new(:rubocop)
|
3
7
|
|
4
8
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
9
|
t.rspec_opts = "--color --format documentation"
|
6
10
|
end
|
7
11
|
|
8
|
-
task :
|
12
|
+
task :test => [:rubocop, :spec]
|
13
|
+
task :default => :test
|
data/hiera-aws.gemspec
CHANGED
@@ -5,16 +5,26 @@ class Hiera
|
|
5
5
|
module Aws
|
6
6
|
class MissingFactError < StandardError; end
|
7
7
|
|
8
|
+
# Base class for all AWS service classes
|
8
9
|
class Base
|
9
|
-
def initialize(scope={})
|
10
|
+
def initialize(scope = {})
|
10
11
|
@scope = scope
|
11
12
|
end
|
12
13
|
|
14
|
+
def aws_region
|
15
|
+
@scope["location"] || "eu-west-1"
|
16
|
+
end
|
17
|
+
|
18
|
+
def aws_account_number
|
19
|
+
@scope["aws_account_number"] ||
|
20
|
+
AWS::IAM.new.users.first.arn.split(":")[4]
|
21
|
+
end
|
22
|
+
|
13
23
|
attr_reader :scope
|
14
24
|
|
15
25
|
def lookup(key, scope)
|
26
|
+
@scope = scope
|
16
27
|
if respond_to? key
|
17
|
-
@scope = scope
|
18
28
|
send(key)
|
19
29
|
else
|
20
30
|
# Found no handler for key
|
@@ -3,11 +3,10 @@ require "hiera/backend/aws/base"
|
|
3
3
|
class Hiera
|
4
4
|
module Backend
|
5
5
|
module Aws
|
6
|
+
# Implementation of Hiera keys for aws/elasticache
|
6
7
|
class ElastiCache < Base
|
7
8
|
def cache_nodes_by_cache_cluster_id
|
8
|
-
|
9
|
-
client = AWS::ElastiCache::Client.new :region => region
|
10
|
-
|
9
|
+
client = AWS::ElastiCache::Client.new :region => aws_region
|
11
10
|
cache_cluster_id = scope["cache_cluster_id"]
|
12
11
|
raise MissingFactError, "cache_cluster_id not found" unless cache_cluster_id
|
13
12
|
options = { :cache_cluster_id => cache_cluster_id, :show_cache_node_info => true }
|
@@ -19,25 +18,21 @@ class Hiera
|
|
19
18
|
# XXX: Lots of spiked code ahead that MUST be refactored.
|
20
19
|
#
|
21
20
|
def cfn_stack_name(instance_id)
|
22
|
-
|
23
|
-
client = AWS::EC2.new :region => region
|
24
|
-
|
21
|
+
client = AWS::EC2.new :region => aws_region
|
25
22
|
instances = client.instances[instance_id]
|
26
23
|
instances.tags["aws:cloudformation:stack-name"]
|
27
24
|
end
|
28
25
|
|
29
26
|
def cache_cluster_info(cluster_id)
|
30
|
-
|
31
|
-
client = AWS::ElastiCache::Client.new :region => region
|
32
|
-
|
27
|
+
client = AWS::ElastiCache::Client.new :region => aws_region
|
33
28
|
options = { :cache_cluster_id => cluster_id, :show_cache_node_info => true }
|
34
29
|
info = client.describe_cache_clusters(options)
|
35
30
|
info.fetch(:cache_clusters).first
|
36
31
|
end
|
37
32
|
|
38
|
-
|
39
|
-
|
40
|
-
client = AWS::CloudFormation.new :region =>
|
33
|
+
# rubocop:disable MultilineBlockChain
|
34
|
+
def cache_clusters_in_cfn_stack(stack_name, cluster_engine = nil)
|
35
|
+
client = AWS::CloudFormation.new :region => aws_region
|
41
36
|
|
42
37
|
stack = client.stacks[stack_name]
|
43
38
|
stack.resources.select do |r|
|
@@ -54,8 +49,9 @@ class Hiera
|
|
54
49
|
end
|
55
50
|
end
|
56
51
|
end
|
52
|
+
# rubocop:enable MultilineBlockChain
|
57
53
|
|
58
|
-
def cluster_nodes_for_cfn_stack(cluster_engine=nil)
|
54
|
+
def cluster_nodes_for_cfn_stack(cluster_engine = nil)
|
59
55
|
ec2_instance_id = scope["ec2_instance_id"]
|
60
56
|
raise MissingFactError, "ec2_instance_id not found" unless ec2_instance_id
|
61
57
|
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "hiera/backend/aws/base"
|
2
|
+
|
3
|
+
class Hiera
|
4
|
+
module Backend
|
5
|
+
module Aws
|
6
|
+
# Implementation of Hiera keys for aws/rds
|
7
|
+
class RDS < Base
|
8
|
+
def initialize(scope = {})
|
9
|
+
super(scope)
|
10
|
+
@client = AWS::RDS::Client.new :region => aws_region
|
11
|
+
end
|
12
|
+
|
13
|
+
# Override default key lookup to implement custom format. Examples:
|
14
|
+
# - hiera("rds")
|
15
|
+
# - hiera("rds environment=dev")
|
16
|
+
# - hiera("rds role=mgmt-db")
|
17
|
+
# - hiera("rds environment=production role=mgmt-db")
|
18
|
+
def lookup(key, scope)
|
19
|
+
r = super(key, scope)
|
20
|
+
return r if r
|
21
|
+
|
22
|
+
args = key.split
|
23
|
+
if args.shift == "rds"
|
24
|
+
if args.length > 0
|
25
|
+
tags = Hash[args.map { |t| t.split("=") }]
|
26
|
+
db_instances_with_tags(tags).map { |i| i[:endpoint][:address] }
|
27
|
+
else
|
28
|
+
db_instances.map { |i| i[:endpoint][:address] }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def db_instances
|
36
|
+
@db_instances ||= @client.describe_db_instances[:db_instances]
|
37
|
+
end
|
38
|
+
|
39
|
+
def db_instances_with_tags(tags)
|
40
|
+
db_instances.select do |i|
|
41
|
+
all_tags = db_instance_tags(i[:db_instance_identifier])
|
42
|
+
tags.all? { |k, v| tags[k] == all_tags[k] }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def db_resource_name(db_instance_id)
|
47
|
+
"arn:aws:rds:#{aws_region}:#{aws_account_number}:db:#{db_instance_id}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def db_instance_tags(db_instance_id)
|
51
|
+
tags = @client.list_tags_for_resource(:resource_name => db_resource_name(db_instance_id))
|
52
|
+
Hash[tags[:tag_list].map { |t| [t[:key], t[:value]] }]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require "hiera/backend/aws/elasticache"
|
2
|
+
require "hiera/backend/aws/rds"
|
2
3
|
|
3
4
|
class Hiera
|
4
5
|
module Backend
|
5
|
-
|
6
|
+
# Hiera AWS backend
|
7
|
+
class Aws_backend # rubocop:disable ClassAndModuleCamelCase
|
6
8
|
def initialize
|
7
9
|
begin
|
8
10
|
require "aws-sdk"
|
@@ -20,16 +22,16 @@ class Hiera
|
|
20
22
|
if Config[:aws] && Config[:aws][:access_key_id] && Config[:aws][:secret_access_key]
|
21
23
|
Hiera.debug("Using AWS credentials from backend configuration")
|
22
24
|
|
23
|
-
AWS.config(
|
25
|
+
AWS.config(
|
24
26
|
:access_key_id => Config[:aws][:access_key_id],
|
25
27
|
:secret_access_key => Config[:aws][:secret_access_key]
|
26
|
-
|
28
|
+
)
|
27
29
|
else
|
28
30
|
Hiera.debug("Using AWS credentials from environment or IAM role")
|
29
31
|
end
|
30
32
|
end
|
31
33
|
|
32
|
-
def lookup(key, scope, order_override, resolution_type)
|
34
|
+
def lookup(key, scope, order_override, resolution_type) # rubocop:disable CyclomaticComplexity
|
33
35
|
Backend.datasources(scope, order_override) do |elem|
|
34
36
|
elements = elem.split "/"
|
35
37
|
next unless elements[0] == "aws"
|
@@ -39,6 +41,8 @@ class Hiera
|
|
39
41
|
service_class = case service
|
40
42
|
when "elasticache"
|
41
43
|
Hiera::Backend::Aws::ElastiCache.new
|
44
|
+
when "rds"
|
45
|
+
Hiera::Backend::Aws::RDS.new
|
42
46
|
end
|
43
47
|
next if service_class.nil?
|
44
48
|
|
@@ -46,7 +50,7 @@ class Hiera
|
|
46
50
|
next if value.nil?
|
47
51
|
|
48
52
|
# this only supports resolution_type => :priority at the moment.
|
49
|
-
# TODO implement :array and :hash merging
|
53
|
+
# TODO: implement :array and :hash merging
|
50
54
|
value = Backend.parse_answer(value, scope)
|
51
55
|
return value unless value.nil?
|
52
56
|
end
|
data/spec/aws_backend_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "hiera/backend/aws_backend"
|
2
2
|
|
3
3
|
class Hiera
|
4
|
-
module Backend
|
4
|
+
module Backend # rubocop:disable Documentation
|
5
5
|
describe Aws_backend do
|
6
6
|
before do
|
7
7
|
Hiera.stub(:debug)
|
@@ -51,6 +51,12 @@ class Hiera
|
|
51
51
|
expect_any_instance_of(Aws::ElastiCache).to receive(:lookup).with(key, scope)
|
52
52
|
backend.lookup(*params)
|
53
53
|
end
|
54
|
+
|
55
|
+
it "properly forwards lookup to RDS service" do
|
56
|
+
Backend.stub(:datasources).and_yield "aws/rds"
|
57
|
+
expect_any_instance_of(Aws::RDS).to receive(:lookup).with(key, scope)
|
58
|
+
backend.lookup(*params)
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
end
|
data/spec/aws_base_spec.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require "hiera/backend/aws/base"
|
2
2
|
|
3
3
|
class Hiera
|
4
|
-
module Backend
|
4
|
+
module Backend # rubocop:disable Documentation
|
5
5
|
describe Aws::Base do
|
6
|
-
let(:service) { Aws::Base.new }
|
7
|
-
|
8
6
|
describe "#lookup" do
|
7
|
+
let(:service) { Aws::Base.new }
|
8
|
+
|
9
9
|
it "returns nil if key is unknown since Hiera iterates over all configured backends" do
|
10
10
|
value = service.lookup("key_with_no_matching_method", {})
|
11
11
|
expect(value).to be_nil
|
@@ -23,6 +23,35 @@ class Hiera
|
|
23
23
|
expect(scope).to eq scope
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
describe "#aws_region" do
|
28
|
+
it "defaults to eu-west-1" do
|
29
|
+
service = Aws::Base.new
|
30
|
+
expect(service.aws_region).to eq "eu-west-1"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "can be set via Puppet fact" do
|
34
|
+
scope = { "location" => "some-aws-region" }
|
35
|
+
service = Aws::Base.new scope
|
36
|
+
expect(service.aws_region).to eq "some-aws-region"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "#aws_account_number" do
|
41
|
+
it "can be set via Puppet fact" do
|
42
|
+
scope = { "aws_account_number" => "12345678" }
|
43
|
+
service = Aws::Base.new scope
|
44
|
+
expect(service.aws_account_number).to eq "12345678"
|
45
|
+
end
|
46
|
+
|
47
|
+
it "is retrieved from AWS when Puppet fact is not set" do
|
48
|
+
AWS::IAM.any_instance.stub(
|
49
|
+
:users => [double(:arn => "arn:aws:iam::12345678:user/some-user")]
|
50
|
+
)
|
51
|
+
service = Aws::Base.new
|
52
|
+
expect(service.aws_account_number).to eq "12345678"
|
53
|
+
end
|
54
|
+
end
|
26
55
|
end
|
27
56
|
end
|
28
57
|
end
|
@@ -1,51 +1,59 @@
|
|
1
1
|
require "hiera/backend/aws/elasticache"
|
2
2
|
|
3
3
|
class Hiera
|
4
|
-
module Backend
|
4
|
+
module Backend # rubocop:disable Documentation
|
5
5
|
describe Aws::ElastiCache do
|
6
|
-
let(:ec_redis_client)
|
7
|
-
|
8
|
-
:
|
9
|
-
:
|
10
|
-
|
11
|
-
|
6
|
+
let(:ec_redis_client) do
|
7
|
+
double(
|
8
|
+
:describe_cache_clusters => {
|
9
|
+
:cache_clusters => [{
|
10
|
+
:cache_nodes => [
|
11
|
+
{ :endpoint => { :address => "1.1.1.1", :port => 1234 } },
|
12
|
+
{ :endpoint => { :address => "2.2.2.2", :port => 1234 } }
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
],
|
15
|
+
:engine => "redis"
|
16
|
+
}]
|
17
|
+
}
|
18
|
+
)
|
19
|
+
end
|
20
|
+
let(:ec_memcached_client) do
|
21
|
+
double(
|
22
|
+
:describe_cache_clusters => {
|
23
|
+
:cache_clusters => [{
|
24
|
+
:cache_nodes => [
|
25
|
+
{ :endpoint => { :address => "3.3.3.3", :port => 5678 } },
|
26
|
+
{ :endpoint => { :address => "4.4.4.4", :port => 5678 } }
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
28
|
+
],
|
29
|
+
:engine => "memcached"
|
30
|
+
}]
|
31
|
+
}
|
32
|
+
)
|
33
|
+
end
|
34
|
+
let(:ec2_client) do
|
35
|
+
double(
|
36
|
+
:instances => {
|
37
|
+
"some-ec2-instance-id" => double(
|
38
|
+
:tags => { "aws:cloudformation:stack-name" => "some-stack-name" }
|
39
|
+
)
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
let(:cfn_client) do
|
44
|
+
double(
|
45
|
+
:stacks => {
|
46
|
+
"some-stack-name" => double(
|
47
|
+
:resources => [
|
48
|
+
double(
|
49
|
+
:resource_type => "AWS::ElastiCache::CacheCluster",
|
50
|
+
:physical_resource_id => "some-cluster-id"
|
51
|
+
)
|
52
|
+
]
|
53
|
+
)
|
54
|
+
}
|
55
|
+
)
|
56
|
+
end
|
49
57
|
|
50
58
|
before do
|
51
59
|
AWS::EC2.stub(:new => ec2_client)
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "hiera/backend/aws/rds"
|
2
|
+
|
3
|
+
class Hiera
|
4
|
+
module Backend # rubocop:disable Documentation
|
5
|
+
describe Aws::RDS do
|
6
|
+
let(:rds) { Aws::RDS.new }
|
7
|
+
let(:rds_instances) do
|
8
|
+
{
|
9
|
+
:db_instances => [
|
10
|
+
{
|
11
|
+
:db_instance_identifier => "db1",
|
12
|
+
:endpoint => { :address => "db1.eu-west-1.rds.amazonaws.com" }
|
13
|
+
},
|
14
|
+
{
|
15
|
+
:db_instance_identifier => "db2",
|
16
|
+
:endpoint => { :address => "db2.eu-west-1.rds.amazonaws.com" }
|
17
|
+
},
|
18
|
+
{
|
19
|
+
:db_instance_identifier => "db3",
|
20
|
+
:endpoint => { :address => "db3.eu-west-1.rds.amazonaws.com" }
|
21
|
+
}
|
22
|
+
]
|
23
|
+
}
|
24
|
+
end
|
25
|
+
let(:rds_tags) do
|
26
|
+
{
|
27
|
+
"arn:aws:rds:eu-west-1:12345678:db:db1" => {
|
28
|
+
:tag_list => [
|
29
|
+
{ :key => "environment", :value => "dev" }
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"arn:aws:rds:eu-west-1:12345678:db:db2" => {
|
33
|
+
:tag_list => [
|
34
|
+
{ :key => "environment", :value => "dev" },
|
35
|
+
{ :key => "role", :value => "mgmt-db" }
|
36
|
+
]
|
37
|
+
},
|
38
|
+
"arn:aws:rds:eu-west-1:12345678:db:db3" => {
|
39
|
+
:tag_list => [
|
40
|
+
{ :key => "environment", :value => "production" },
|
41
|
+
{ :key => "role", :value => "mgmt-db" }
|
42
|
+
]
|
43
|
+
}
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
before do
|
48
|
+
rds_client = double
|
49
|
+
AWS::RDS::Client.stub(:new).and_return(rds_client)
|
50
|
+
allow(rds_client).to receive(:describe_db_instances).and_return(rds_instances)
|
51
|
+
allow(rds_client).to receive(:list_tags_for_resource) do |options|
|
52
|
+
rds_tags.fetch(options[:resource_name])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "#lookup" do
|
57
|
+
let(:scope) { { "aws_account_number" => "12345678" } }
|
58
|
+
|
59
|
+
it "returns nil if Hiera key is unknown" do
|
60
|
+
expect(rds.lookup("doge", scope)).to be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it "returns all database instances if no tags are provided" do
|
64
|
+
expect(rds.lookup("rds", scope)).to eq ["db1.eu-west-1.rds.amazonaws.com",
|
65
|
+
"db2.eu-west-1.rds.amazonaws.com",
|
66
|
+
"db3.eu-west-1.rds.amazonaws.com"]
|
67
|
+
end
|
68
|
+
|
69
|
+
it "returns database instances with specific tags" do
|
70
|
+
expect(rds.lookup("rds role=mgmt-db", scope)).to eq ["db2.eu-west-1.rds.amazonaws.com",
|
71
|
+
"db3.eu-west-1.rds.amazonaws.com"]
|
72
|
+
expect(rds.lookup("rds environment=dev", scope)).to eq ["db1.eu-west-1.rds.amazonaws.com",
|
73
|
+
"db2.eu-west-1.rds.amazonaws.com"]
|
74
|
+
expect(rds.lookup("rds environment=production role=mgmt-db", scope)).to eq ["db3.eu-west-1.rds.amazonaws.com"]
|
75
|
+
end
|
76
|
+
|
77
|
+
it "returns empty array if no database instances can be found" do
|
78
|
+
expect(rds.lookup("rds environment=staging", scope)).to eq []
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Lafeldt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rubocop
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
70
84
|
description: Hiera AWS Backend
|
71
85
|
email:
|
72
86
|
- mathias.lafeldt@jimdo.com
|
@@ -76,6 +90,7 @@ extensions: []
|
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
78
92
|
- .gitignore
|
93
|
+
- .rubocop.yml
|
79
94
|
- .travis.yml
|
80
95
|
- Gemfile
|
81
96
|
- LICENSE
|
@@ -84,11 +99,13 @@ files:
|
|
84
99
|
- hiera-aws.gemspec
|
85
100
|
- lib/hiera/backend/aws/base.rb
|
86
101
|
- lib/hiera/backend/aws/elasticache.rb
|
102
|
+
- lib/hiera/backend/aws/rds.rb
|
87
103
|
- lib/hiera/backend/aws/version.rb
|
88
104
|
- lib/hiera/backend/aws_backend.rb
|
89
105
|
- spec/aws_backend_spec.rb
|
90
106
|
- spec/aws_base_spec.rb
|
91
107
|
- spec/aws_elasticache_spec.rb
|
108
|
+
- spec/aws_rds_spec.rb
|
92
109
|
homepage: https://github.com/Jimdo/hiera-aws
|
93
110
|
licenses:
|
94
111
|
- Apache 2.0
|
@@ -117,3 +134,4 @@ test_files:
|
|
117
134
|
- spec/aws_backend_spec.rb
|
118
135
|
- spec/aws_base_spec.rb
|
119
136
|
- spec/aws_elasticache_spec.rb
|
137
|
+
- spec/aws_rds_spec.rb
|