terraforming 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/terraforming.rb +1 -0
- data/lib/terraforming/cli.rb +5 -0
- data/lib/terraforming/resource/route_table_association.rb +58 -0
- data/lib/terraforming/template/tf/route_table_association.erb +11 -0
- data/lib/terraforming/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b1f50c3f84ccc4dfc4711cf892970dad4c31a78
|
4
|
+
data.tar.gz: e31b9c882752330e18ee8638079b81f95f0736c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648c08e76bddd466e98e316d1edd3bca1cf9ba8171763f854ef5b6a403c3ece59a1763e78ac3f45558fdfeefe0e1cc2518330839457ac159d535030f22f1d0fd
|
7
|
+
data.tar.gz: 937ca25cc117252eb7ecd4f0797f9954a7cda9ac37f01fb4fa9ea7c227286417ecb7a54dc3f700468c1ee3b8a58db095dea6fa639860257150c9d0d3370f4539
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/terraforming.rb
CHANGED
@@ -33,6 +33,7 @@ require "terraforming/resource/network_acl"
|
|
33
33
|
require "terraforming/resource/network_interface"
|
34
34
|
require "terraforming/resource/rds"
|
35
35
|
require "terraforming/resource/route_table"
|
36
|
+
require "terraforming/resource/route_table_association"
|
36
37
|
require "terraforming/resource/route53_record"
|
37
38
|
require "terraforming/resource/route53_zone"
|
38
39
|
require "terraforming/resource/s3"
|
data/lib/terraforming/cli.rb
CHANGED
@@ -125,6 +125,11 @@ module Terraforming
|
|
125
125
|
execute(Terraforming::Resource::RouteTable, options)
|
126
126
|
end
|
127
127
|
|
128
|
+
desc "rta", "Route Table Association"
|
129
|
+
def rta
|
130
|
+
execute(Terraforming::Resource::RouteTableAssociation, options)
|
131
|
+
end
|
132
|
+
|
128
133
|
desc "s3", "S3"
|
129
134
|
def s3
|
130
135
|
execute(Terraforming::Resource::S3, options)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Terraforming
|
2
|
+
module Resource
|
3
|
+
class RouteTableAssociation
|
4
|
+
include Terraforming::Util
|
5
|
+
|
6
|
+
def self.tf(client: Aws::EC2::Client.new)
|
7
|
+
self.new(client).tf
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.tfstate(client: Aws::EC2::Client.new)
|
11
|
+
self.new(client).tfstate
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(client)
|
15
|
+
@client = client
|
16
|
+
end
|
17
|
+
|
18
|
+
def tf
|
19
|
+
apply_template(@client, "tf/route_table_association")
|
20
|
+
end
|
21
|
+
|
22
|
+
def tfstate
|
23
|
+
resources = {}
|
24
|
+
route_tables.each do |route_table|
|
25
|
+
associations_of(route_table).each do |assoc|
|
26
|
+
attributes = {
|
27
|
+
"id" => assoc.route_table_association_id,
|
28
|
+
"route_table_id" => assoc.route_table_id,
|
29
|
+
"subnet_id" => assoc.subnet_id,
|
30
|
+
}
|
31
|
+
resources["aws_route_table_association.#{module_name_of(route_table, assoc)}"] = {
|
32
|
+
"type" => "aws_route_table_association",
|
33
|
+
"primary" => {
|
34
|
+
"id" => assoc.route_table_association_id,
|
35
|
+
"attributes" => attributes
|
36
|
+
}
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
resources
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def associations_of(route_table)
|
46
|
+
route_table.associations
|
47
|
+
end
|
48
|
+
|
49
|
+
def module_name_of(route_table, assoc)
|
50
|
+
normalize_module_name(name_from_tag(route_table, route_table.route_table_id) + '-' + assoc.route_table_association_id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def route_tables
|
54
|
+
@client.describe_route_tables.route_tables
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% route_tables.each do |route_table| -%>
|
2
|
+
<% associations_of(route_table).each do |assoc| -%>
|
3
|
+
<% if assoc.subnet_id -%>
|
4
|
+
resource "aws_route_table_association" "<%= module_name_of(route_table, assoc) %>" {
|
5
|
+
route_table_id = "<%= assoc.route_table_id %>"
|
6
|
+
subnet_id = "<%= assoc.subnet_id %>"
|
7
|
+
}
|
8
|
+
|
9
|
+
<% end -%>
|
10
|
+
<% end -%>
|
11
|
+
<% end -%>
|
data/lib/terraforming/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Fujita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/terraforming/resource/route53_record.rb
|
210
210
|
- lib/terraforming/resource/route53_zone.rb
|
211
211
|
- lib/terraforming/resource/route_table.rb
|
212
|
+
- lib/terraforming/resource/route_table_association.rb
|
212
213
|
- lib/terraforming/resource/s3.rb
|
213
214
|
- lib/terraforming/resource/security_group.rb
|
214
215
|
- lib/terraforming/resource/subnet.rb
|
@@ -237,6 +238,7 @@ files:
|
|
237
238
|
- lib/terraforming/template/tf/route53_record.erb
|
238
239
|
- lib/terraforming/template/tf/route53_zone.erb
|
239
240
|
- lib/terraforming/template/tf/route_table.erb
|
241
|
+
- lib/terraforming/template/tf/route_table_association.erb
|
240
242
|
- lib/terraforming/template/tf/s3.erb
|
241
243
|
- lib/terraforming/template/tf/security_group.erb
|
242
244
|
- lib/terraforming/template/tf/subnet.erb
|
@@ -266,9 +268,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
268
|
version: '0'
|
267
269
|
requirements: []
|
268
270
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.4.
|
271
|
+
rubygems_version: 2.4.5.1
|
270
272
|
signing_key:
|
271
273
|
specification_version: 4
|
272
274
|
summary: Export existing AWS resources to Terraform style (tf, tfstate)
|
273
275
|
test_files: []
|
274
|
-
has_rdoc:
|