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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 838cb35c9f3ccaf96a07929407282dd25620a2ce
4
- data.tar.gz: 2c81b7c5a24cc7e19e3679ec6c5341eac4ef18c0
3
+ metadata.gz: 9b1f50c3f84ccc4dfc4711cf892970dad4c31a78
4
+ data.tar.gz: e31b9c882752330e18ee8638079b81f95f0736c8
5
5
  SHA512:
6
- metadata.gz: 43f07b3a3fe4953da6c189b946cb628bb9b73ae9b8474c026bca836d61aace8f63f16dd1b73b4e971265cb9093ead75077bd082ae65df49292f6842925d9c234
7
- data.tar.gz: 6e469450a3de21eb142db4fe9263e7546c173b78f5adc7d666b199ace5927c048e23192f65e20dacb96ae89c24612e3e9b34138cae7cb492c74097d41642ad37
6
+ metadata.gz: 648c08e76bddd466e98e316d1edd3bca1cf9ba8171763f854ef5b6a403c3ece59a1763e78ac3f45558fdfeefe0e1cc2518330839457ac159d535030f22f1d0fd
7
+ data.tar.gz: 937ca25cc117252eb7ecd4f0797f9954a7cda9ac37f01fb4fa9ea7c227286417ecb7a54dc3f700468c1ee3b8a58db095dea6fa639860257150c9d0d3370f4539
@@ -1,3 +1,9 @@
1
+ # [v0.6.0](https://github.com/dtan4/terraforming/releases/tag/v0.5.0) (2015-11-21)
2
+
3
+ ## Resource
4
+
5
+ - AWS Route Table Association #138 (thanks @k1LoW)
6
+
1
7
  # [v0.5.0](https://github.com/dtan4/terraforming/releases/tag/v0.5.0) (2015-11-20)
2
8
 
3
9
  ## Resource
data/README.md CHANGED
@@ -90,6 +90,7 @@ Commands:
90
90
  terraforming r53z # Route53 Hosted Zone
91
91
  terraforming rds # RDS
92
92
  terraforming rt # Route Table
93
+ terraforming rta # Route Table Association
93
94
  terraforming s3 # S3
94
95
  terraforming sg # Security Group
95
96
  terraforming sn # Subnet
@@ -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"
@@ -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 -%>
@@ -1,3 +1,3 @@
1
1
  module Terraforming
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.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-20 00:00:00.000000000 Z
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.8
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: