terrafying 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/terrafying/aws.rb +18 -7
- data/lib/terrafying/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22e15cb8bade7db18b7a76f6a6c912b52476cfd
|
4
|
+
data.tar.gz: 71551b258663fd61a90374074cbab2c1016f2177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e658117299c524fb658e489b95ba6289414a9c246600abdde4d30d18bbdb8dc177e3b5a3695ae1a9605772631c5ab4c9bf2cafde56da7a2fe9a00dac4405ac
|
7
|
+
data.tar.gz: f45615ee481693852540c32e90971d34d3f8a9348b1f3462399945fd89e10920290b392dfee261cf1ba23eeea078f3e7f29efa5eab2424eecfdc9e0c8d87dc97
|
data/lib/terrafying/aws.rb
CHANGED
@@ -9,8 +9,12 @@ module Terrafying
|
|
9
9
|
attr_reader :region
|
10
10
|
|
11
11
|
def initialize(region)
|
12
|
+
full_jitter = lambda { |c| Kernel.sleep(Kernel.rand(0..[2, (0.3 * 2**c.retries)].min)) }
|
13
|
+
|
12
14
|
::Aws.config.update({
|
13
|
-
region: region
|
15
|
+
region: region,
|
16
|
+
retry_limit: 5,
|
17
|
+
retry_backoff: full_jitter
|
14
18
|
})
|
15
19
|
@autoscaling_client = ::Aws::AutoScaling::Client.new
|
16
20
|
@ec2_resource = ::Aws::EC2::Resource.new
|
@@ -353,15 +357,22 @@ module Terrafying
|
|
353
357
|
@hosted_zones[tag] ||=
|
354
358
|
begin
|
355
359
|
STDERR.puts "looking for a hosted zone with tag '#{tag}'"
|
356
|
-
|
357
|
-
|
358
|
-
|
360
|
+
@aws_hosted_zones ||= @route53_client.list_hosted_zones.hosted_zones.map do |zone|
|
361
|
+
{
|
362
|
+
zone: zone,
|
363
|
+
tags: @route53_client.list_tags_for_resource({resource_type: "hostedzone", resource_id: zone.id.split('/')[2]}).resource_tag_set.tags
|
359
364
|
}
|
360
|
-
|
361
|
-
|
365
|
+
end
|
366
|
+
|
367
|
+
hosted_zones = @aws_hosted_zones.select do |z|
|
368
|
+
z[:tags].any? do |aws_tag|
|
369
|
+
tag.any? { |k, v| aws_tag.key = String(k) && aws_tag.value == v }
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
362
373
|
case
|
363
374
|
when hosted_zones.count == 1
|
364
|
-
hosted_zones.first
|
375
|
+
hosted_zones.first[:zone]
|
365
376
|
when hosted_zones.count < 1
|
366
377
|
raise "No hosted zone with tag '#{tag}' was found."
|
367
378
|
when hosted_zones.count > 1
|
data/lib/terrafying/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terrafying
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uSwitch Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|