convection 2.2.10 → 2.2.11

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: f7c478ce35a94d9130d3d2657a092bdb5436f505
4
- data.tar.gz: d5dff048c6a317a79b0b8df5743f148768e0b368
3
+ metadata.gz: e4f86707af23a4ea618cd13b4dd4008a23a22bbb
4
+ data.tar.gz: c71c29ecbb07f321eca21c86864d3a6c2f893945
5
5
  SHA512:
6
- metadata.gz: 4690a2b22a2988cd38cb7ae2d8e2dceac1bdd7f0b2080d3a2a42190b2ff2ed6033733b6ddfad97e6afd44c409e92a0c5a97f8220346f62f68ca37e871f03de7f
7
- data.tar.gz: 1104ceadddfcc37b30dc12804e8e65b3fd580328421788da03fd6f90a3eb5f5df0ecac2da0bafa1d1a535668c7c4ba30092365521365d0fe28d544662f61b779
6
+ metadata.gz: ffc9509d0c997d2cc41ce1915a8ec5128aa4b53082f1ad157e917a9b53dde285b0a0a00e5795f8fc18f53347669000c49d45ffc7fcac7ebea532722ed8221ddf
7
+ data.tar.gz: a3b08777d66def2af42eeba6b1815d3b5a892beab7e945ef4a8b29e29add7e3b7b7700644a2ee4f38590efe01a3c5c2d7b8de991e5425a797602e0ea38e65e1d
@@ -303,7 +303,7 @@ module Convection
303
303
  end
304
304
  end
305
305
 
306
- def import_resources(_resource_name, resource)
306
+ def import_resources(resource_name, resource)
307
307
  empty_directory options[:output_directory] if resource.respond_to?(:to_hcl_json) || resource.respond_to?(:additional_hcl_files)
308
308
  if resource.respond_to?(:to_hcl_json)
309
309
  destination = File.join(options[:output_directory], "#{resource.name.underscore}.tf.json")
@@ -8,6 +8,9 @@ module Convection
8
8
  # AWS::EC2::Instance
9
9
  ##
10
10
  class Route53RecordSet < Resource
11
+ TF_ASSUMED_RESOURCE_NAME = 'aws_elastic_load_balancing_load_balancer'.freeze
12
+ TF_ACTUAL_RESOURCE_NAME = 'aws_elb'.freeze
13
+
11
14
  type 'AWS::Route53::RecordSet', :route53_recordset
12
15
  property :alias_tgt, 'AliasTarget'
13
16
  property :comment, 'Comment'
@@ -49,6 +52,43 @@ module Convection
49
52
  properties['GeoLocation'].set(g)
50
53
  end
51
54
  end
55
+
56
+ def terraform_import_commands(module_path: 'root')
57
+ commands = []
58
+ commands << '# Import the Route53 record:'
59
+ tf_set_id = "_#{set_identifier}" if set_identifier
60
+ prefix = "#{module_path}." unless module_path == 'root'
61
+ tf_record_name = record_name.sub(/\.$/, '')
62
+ commands << "terraform import #{prefix}aws_route53_record.#{name.underscore} #{hosted_zone_id}_#{tf_record_name}_#{record_type}#{tf_set_id}"
63
+
64
+ commands.map { |cmd| cmd.gsub(stack.region, stack._original_region).gsub(stack.cloud, stack._original_cloud) }
65
+ end
66
+
67
+ def to_hcl_json(*)
68
+ tf_record_attrs = {
69
+ zone_id: hosted_zone_id,
70
+ name: record_name,
71
+ type: record_type,
72
+ ttl: ttl,
73
+ records: tf_records,
74
+ set_identifier: set_identifier
75
+ }
76
+ tf_record_attrs.reject! { |_k, v| v.nil? }
77
+
78
+ tf_record = {
79
+ aws_route53_record: {
80
+ name.underscore => tf_record_attrs
81
+ }
82
+ }
83
+
84
+ { resource: [tf_record] }.to_json
85
+ end
86
+
87
+ private
88
+
89
+ def tf_records
90
+ record.map { |r| r.gsub(TF_ASSUMED_RESOURCE_NAME, TF_ACTUAL_RESOURCE_NAME) }
91
+ end
52
92
  end
53
93
  end
54
94
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convection
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Manero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport