convection 2.2.11 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06fa6942996ee32f586741975300cad7ddd11e83
|
4
|
+
data.tar.gz: f393211f45deac206370eaa9c5c7163547b563da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0801e86aef339edd14e256942d10c641ade985171fca98f15db341a0ef18652230cb0a8c9762dda1f048a68ac47f27164cf08bcbba7397a4fd1aa8ffeac885f7'
|
7
|
+
data.tar.gz: d110b282f788d2479e8984f3117ed339244019ea51efaa284be93bee0cc021967b07357ff172bb5ba82c4b7d9a113c83147d4cc53b55e3f7aa9a8b38e1149057
|
data/bin/convection
CHANGED
@@ -225,7 +225,9 @@ module Convection
|
|
225
225
|
|
226
226
|
# Get the function and permission resource summaries.
|
227
227
|
permission_resource_summary = stack.resources[name]
|
228
|
-
|
228
|
+
permission_resource = stack.template.resources[name]
|
229
|
+
lambda_resource_logical_id = lambda_resource_logical_id(permission_resource: permission_resource)
|
230
|
+
function_resource_summary = lambda_resource_logical_id && stack.resources[lambda_resource_logical_id]
|
229
231
|
unless permission_resource_summary && function_resource_summary
|
230
232
|
warn 'ERROR: Either the lambda permission or function you were trying to import have not been created in cloudformation. These resources are expected to exist in the same template.'
|
231
233
|
exit 1
|
@@ -238,7 +240,7 @@ module Convection
|
|
238
240
|
end
|
239
241
|
|
240
242
|
function_name = resource.function_name.is_a?(Hash) ? function_resource_summary.physical_resource_id : resource.function_name
|
241
|
-
|
243
|
+
source_logical_name = resource.source_arn.is_a?(Hash) ? resource.source_arn.fetch('Fn::GetAtt', []).first : resource.source_arn
|
242
244
|
source_resource_summary = stack.resources[source_logical_name] && stack.resources[source_logical_name].physical_resource_id
|
243
245
|
source_arn = resource.source_arn.is_a?(Hash) ? source_resource_summary : resource.source_arn
|
244
246
|
unless source_arn
|
@@ -257,6 +259,7 @@ module Convection
|
|
257
259
|
principal: resource.principal,
|
258
260
|
qualifer: resource.qualifer,
|
259
261
|
source_arn: source_arn,
|
262
|
+
source_account: resource.source_account,
|
260
263
|
statement_id: permission_resource_summary.physical_resource_id
|
261
264
|
}.reject { |_key, value| value.nil? },
|
262
265
|
meta: {},
|
@@ -342,6 +345,16 @@ module Convection
|
|
342
345
|
puts # Print an additional new line
|
343
346
|
end
|
344
347
|
|
348
|
+
def lambda_resource_logical_id(permission_resource:)
|
349
|
+
return nil unless permission_resource
|
350
|
+
|
351
|
+
if permission_resource.function_name.is_a?(Hash)
|
352
|
+
return permission_resource.function_name['Ref'] if permission_resource.function_name.key?('Ref')
|
353
|
+
end
|
354
|
+
|
355
|
+
permission_resource.name.sub(/Permission.*$/, 'Lambda')
|
356
|
+
end
|
357
|
+
|
345
358
|
def operation(task_name, stack)
|
346
359
|
work_q = Queue.new
|
347
360
|
semaphore = Mutex.new
|
@@ -16,6 +16,32 @@ module Convection
|
|
16
16
|
property :instance, 'InstanceId'
|
17
17
|
property :interface, 'NetworkInterfaceId'
|
18
18
|
property :peer, 'VpcPeeringConnectionId'
|
19
|
+
|
20
|
+
def to_hcl_json(*)
|
21
|
+
tf_record_attrs = {
|
22
|
+
route_table_id: route_table_id,
|
23
|
+
destination_cidr_block: destination,
|
24
|
+
vpc_peering_connection_id: peer,
|
25
|
+
gateway_id: gateway,
|
26
|
+
nat_gateway_id: nat_gateway,
|
27
|
+
instance_id: instance,
|
28
|
+
network_interface_id: interface
|
29
|
+
}
|
30
|
+
|
31
|
+
tf_record_attrs.reject! { |_, v| v.nil? }
|
32
|
+
|
33
|
+
tf_record = {
|
34
|
+
aws_route: {
|
35
|
+
name.underscore => tf_record_attrs
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
{ resource: tf_record }.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
def terraform_import_commands(*)
|
43
|
+
['# Route import is not supported by Terraform.']
|
44
|
+
end
|
19
45
|
end
|
20
46
|
end
|
21
47
|
end
|
@@ -38,6 +38,33 @@ module Convection
|
|
38
38
|
render_tags(resource)
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
def to_hcl_json(*)
|
43
|
+
tf_record_tags = tags.reject { |_, v| v.nil? }
|
44
|
+
|
45
|
+
tf_record_attrs = {
|
46
|
+
vpc_id: vpc,
|
47
|
+
tags: tf_record_tags
|
48
|
+
}
|
49
|
+
|
50
|
+
tf_record_attrs.reject! { |_, v| v.nil? }
|
51
|
+
|
52
|
+
tf_record = {
|
53
|
+
aws_route_table: {
|
54
|
+
name.underscore => tf_record_attrs
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
{ resource: tf_record }.to_json
|
59
|
+
end
|
60
|
+
|
61
|
+
def terraform_import_commands(module_path: 'root')
|
62
|
+
prefix = "#{module_path}." unless module_path == 'root'
|
63
|
+
resource_id = stack.resources[name] && stack.resources[name].physical_resource_id
|
64
|
+
commands = ['# Import the Route Table record:']
|
65
|
+
commands << "terraform import #{prefix}aws_route_table.#{name.underscore} #{resource_id}"
|
66
|
+
commands
|
67
|
+
end
|
41
68
|
end
|
42
69
|
end
|
43
70
|
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.
|
4
|
+
version: 2.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Manero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|