terraforming 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +9 -0
- data/lib/terraforming/resource/route53_record.rb +22 -4
- data/lib/terraforming/template/tf/route53_record.erb +23 -2
- data/lib/terraforming/version.rb +1 -1
- data/terraforming.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a27178069da9153155aff37de42e68a2783e1899
|
4
|
+
data.tar.gz: ad3de0470f2e0f0e4d994b9778270dd0a7b0495b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e4bf304665b0657c1e4c328dfcdc74596b1f6def38612c3fd8866ac833d841f62cc5d3e480075262e617d45f8a517bacf1c394b31c77ec74826b4a525aea7f8
|
7
|
+
data.tar.gz: '0239a7d087365a73e04d5d9b7a04b3dd04bdc0620a89fe5e6653d4b16474b7b0981275ecd5c1c120510c415338fb427b50fdbd00dc588d9c12ae1301adf63234'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# [v0.13.1](https://github.com/dtan4/terraforming/releases/tag/v0.13.1) (2017-01-23)
|
2
|
+
|
3
|
+
## Fixed / Updated
|
4
|
+
|
5
|
+
- Fixes for route53_records [#303](https://github.com/dtan4/terraforming/pull/303) (thanks @mioi)
|
6
|
+
- use `weighted_routing_policy`
|
7
|
+
- add various routing policy (latency, geolocation)
|
8
|
+
- uniquify resource name
|
9
|
+
|
1
10
|
# [v0.13.0](https://github.com/dtan4/terraforming/releases/tag/v0.13.0) (2017-01-12)
|
2
11
|
|
3
12
|
## Resource
|
@@ -22,6 +22,7 @@ module Terraforming
|
|
22
22
|
def tfstate
|
23
23
|
records.inject({}) do |resources, r|
|
24
24
|
record, zone_id = r[:record], r[:zone_id]
|
25
|
+
counter = r[:counter]
|
25
26
|
record_id = record_id_of(record, zone_id)
|
26
27
|
|
27
28
|
attributes = {
|
@@ -35,9 +36,17 @@ module Terraforming
|
|
35
36
|
attributes["records.#"] = record.resource_records.length.to_s unless record.resource_records.empty?
|
36
37
|
attributes["ttl"] = record.ttl.to_s if record.ttl
|
37
38
|
attributes["weight"] = record.weight ? record.weight.to_s : "-1"
|
39
|
+
attributes["region"] = record.region if record.region
|
40
|
+
|
41
|
+
if record.geo_location
|
42
|
+
attributes["continent"] = record.geo_location.continent_code if record.geo_location.continent_code
|
43
|
+
attributes["country"] = record.geo_location.country_code if record.geo_location.country_code
|
44
|
+
attributes["subdivision"] = record.geo_location.subdivision_code if record.geo_location.subdivision_code
|
45
|
+
end
|
46
|
+
|
38
47
|
attributes["set_identifier"] = record.set_identifier if record.set_identifier
|
39
48
|
|
40
|
-
resources["aws_route53_record.#{module_name_of(record)}"] = {
|
49
|
+
resources["aws_route53_record.#{module_name_of(record, counter)}"] = {
|
41
50
|
"type" => "aws_route53_record",
|
42
51
|
"primary" => {
|
43
52
|
"id" => record_id,
|
@@ -66,9 +75,18 @@ module Terraforming
|
|
66
75
|
end
|
67
76
|
|
68
77
|
def records
|
69
|
-
hosted_zones.map do |hosted_zone|
|
78
|
+
to_return = hosted_zones.map do |hosted_zone|
|
70
79
|
record_sets_of(hosted_zone).map { |record| { record: record, zone_id: zone_id_of(hosted_zone) } }
|
71
80
|
end.flatten
|
81
|
+
count = {}
|
82
|
+
dups = to_return.group_by { |record| module_name_of(record[:record], nil) }.select { |_, v| v.size > 1 }.map(&:first)
|
83
|
+
to_return.each do |r|
|
84
|
+
module_name = module_name_of(r[:record], nil)
|
85
|
+
next unless dups.include?(module_name)
|
86
|
+
count[module_name] = count[module_name] ? count[module_name] + 1 : 0
|
87
|
+
r[:counter] = count[module_name]
|
88
|
+
end
|
89
|
+
to_return
|
72
90
|
end
|
73
91
|
|
74
92
|
# TODO(dtan4): change method name...
|
@@ -76,8 +94,8 @@ module Terraforming
|
|
76
94
|
dns_name.gsub(/\.\z/, "")
|
77
95
|
end
|
78
96
|
|
79
|
-
def module_name_of(record)
|
80
|
-
normalize_module_name(name_of(record.name) + "-" + record.type)
|
97
|
+
def module_name_of(record, counter)
|
98
|
+
normalize_module_name(name_of(record.name) + "-" + record.type + (!counter.nil? ? "-" + counter.to_s : ""))
|
81
99
|
end
|
82
100
|
|
83
101
|
def zone_id_of(hosted_zone)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<% records.each do |r| -%>
|
2
2
|
<%- record, zone_id = r[:record], r[:zone_id] -%>
|
3
|
-
|
3
|
+
<%- counter = r[:counter] -%>
|
4
|
+
resource "aws_route53_record" "<%= module_name_of(record, counter) %>" {
|
4
5
|
zone_id = "<%= zone_id %>"
|
5
6
|
name = "<%= name_of(record.name.sub(/\\052/, '*')) %>"
|
6
7
|
type = "<%= record.type %>"
|
@@ -11,7 +12,27 @@ resource "aws_route53_record" "<%= module_name_of(record) %>" {
|
|
11
12
|
ttl = "<%= record.ttl %>"
|
12
13
|
<%- end -%>
|
13
14
|
<%- if record.weight -%>
|
14
|
-
|
15
|
+
weighted_routing_policy {
|
16
|
+
weight = <%= record.weight %>
|
17
|
+
}
|
18
|
+
<%- end -%>
|
19
|
+
<%- if record.region -%>
|
20
|
+
latency_routing_policy {
|
21
|
+
region = "<%= record.region %>"
|
22
|
+
}
|
23
|
+
<%- end -%>
|
24
|
+
<%- if record.geo_location -%>
|
25
|
+
geolocation_routing_policy {
|
26
|
+
<%- if record.geo_location.continent_code -%>
|
27
|
+
continent = "<%= record.geo_location.continent_code %>"
|
28
|
+
<%- end -%>
|
29
|
+
<%- if record.geo_location.country_code -%>
|
30
|
+
country = "<%= record.geo_location.country_code %>"
|
31
|
+
<%- end -%>
|
32
|
+
<%- if record.geo_location.subdivision_code -%>
|
33
|
+
subdivision = "<%= record.geo_location.subdivision_code %>"
|
34
|
+
<%- end -%>
|
35
|
+
}
|
15
36
|
<%- end -%>
|
16
37
|
<%- if record.set_identifier -%>
|
17
38
|
set_identifier = "<%= record.set_identifier %>"
|
data/lib/terraforming/version.rb
CHANGED
data/terraforming.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "aws-sdk", "~> 2.
|
22
|
+
spec.add_dependency "aws-sdk", "~> 2.7.0"
|
23
23
|
spec.add_dependency "multi_json", "~> 1.12.1"
|
24
24
|
spec.add_dependency "thor"
|
25
25
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraforming
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Fujita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.7.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.7.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|
259
259
|
rubyforge_project:
|
260
|
-
rubygems_version: 2.6.
|
260
|
+
rubygems_version: 2.6.9
|
261
261
|
signing_key:
|
262
262
|
specification_version: 4
|
263
263
|
summary: Export existing AWS resources to Terraform style (tf, tfstate)
|