sparkle_formation 3.0.30 → 3.0.32
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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/sparkle_formation.rb +23 -23
- data/lib/sparkle_formation/aws.rb +1 -1
- data/lib/sparkle_formation/composition.rb +7 -7
- data/lib/sparkle_formation/error.rb +2 -2
- data/lib/sparkle_formation/function_struct.rb +22 -22
- data/lib/sparkle_formation/provider.rb +7 -7
- data/lib/sparkle_formation/provider/aws.rb +28 -28
- data/lib/sparkle_formation/provider/azure.rb +7 -7
- data/lib/sparkle_formation/provider/google.rb +16 -16
- data/lib/sparkle_formation/provider/heat.rb +6 -6
- data/lib/sparkle_formation/provider/terraform.rb +7 -7
- data/lib/sparkle_formation/resources.rb +18 -18
- data/lib/sparkle_formation/resources/aws.rb +216 -126
- data/lib/sparkle_formation/resources/aws_resources.json +3463 -1601
- data/lib/sparkle_formation/resources/azure.rb +6 -6
- data/lib/sparkle_formation/resources/google.rb +7 -7
- data/lib/sparkle_formation/resources/heat.rb +2 -2
- data/lib/sparkle_formation/resources/rackspace.rb +2 -2
- data/lib/sparkle_formation/resources/terraform.rb +6 -6
- data/lib/sparkle_formation/sparkle.rb +32 -32
- data/lib/sparkle_formation/sparkle_attribute.rb +10 -10
- data/lib/sparkle_formation/sparkle_attribute/aws.rb +30 -30
- data/lib/sparkle_formation/sparkle_attribute/azure.rb +39 -39
- data/lib/sparkle_formation/sparkle_attribute/google.rb +19 -19
- data/lib/sparkle_formation/sparkle_attribute/heat.rb +16 -16
- data/lib/sparkle_formation/sparkle_attribute/rackspace.rb +1 -1
- data/lib/sparkle_formation/sparkle_attribute/terraform.rb +41 -41
- data/lib/sparkle_formation/sparkle_collection.rb +4 -4
- data/lib/sparkle_formation/sparkle_collection/rainbow.rb +3 -3
- data/lib/sparkle_formation/sparkle_formation.rb +31 -31
- data/lib/sparkle_formation/sparkle_struct.rb +5 -5
- data/lib/sparkle_formation/translation.rb +32 -32
- data/lib/sparkle_formation/translation/heat.rb +126 -126
- data/lib/sparkle_formation/translation/rackspace.rb +118 -118
- data/lib/sparkle_formation/utils.rb +5 -5
- data/lib/sparkle_formation/version.rb +1 -1
- data/sparkle_formation.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee99fa6d41cebeb6ced3d79f39ebc5caded4179d01eecd2c15f435057856b0fe
|
4
|
+
data.tar.gz: e2a4ca7febb8b5de48dc4d2731c922d05be53c85fa27bf7360e5ae98df3a41c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b15efc35a98bb669a3eb3dfe55b5095e1716af599b2e21c94c67cd12c01af42646c10c6a17d6793564b1353d2a63acd8420fae4fa1eb6d9b68777c386c6b936
|
7
|
+
data.tar.gz: ec4a9a34e04600b1f9395a48007bda3aab11cd12d4be4a1472f7782a7472c7d152f688d985e50cf78de8f47ed309b65bab87e05e8703ef7b4616d34d1ca1b013
|
data/CHANGELOG.md
CHANGED
data/lib/sparkle_formation.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "bogo"
|
2
|
+
require "multi_json"
|
3
|
+
require "attribute_struct"
|
4
4
|
|
5
5
|
# Unicorns and rainbows
|
6
6
|
class SparkleFormation
|
7
|
-
autoload :Aws,
|
8
|
-
autoload :AzureVariableStruct,
|
9
|
-
autoload :Composition,
|
10
|
-
autoload :Error,
|
11
|
-
autoload :FunctionStruct,
|
12
|
-
autoload :GoogleStruct,
|
13
|
-
autoload :JinjaExpressionStruct,
|
14
|
-
autoload :JinjaStatementStruct,
|
15
|
-
autoload :Provider,
|
16
|
-
autoload :Resources,
|
17
|
-
autoload :Sparkle,
|
18
|
-
autoload :SparklePack,
|
19
|
-
autoload :SparkleCollection,
|
20
|
-
autoload :SparkleAttribute,
|
21
|
-
autoload :SparkleStruct,
|
22
|
-
autoload :TerraformStruct,
|
23
|
-
autoload :Utils,
|
24
|
-
autoload :Translation,
|
25
|
-
autoload :Version,
|
7
|
+
autoload :Aws, "sparkle_formation/aws"
|
8
|
+
autoload :AzureVariableStruct, "sparkle_formation/function_struct"
|
9
|
+
autoload :Composition, "sparkle_formation/composition"
|
10
|
+
autoload :Error, "sparkle_formation/error"
|
11
|
+
autoload :FunctionStruct, "sparkle_formation/function_struct"
|
12
|
+
autoload :GoogleStruct, "sparkle_formation/function_struct"
|
13
|
+
autoload :JinjaExpressionStruct, "sparkle_formation/function_struct"
|
14
|
+
autoload :JinjaStatementStruct, "sparkle_formation/function_struct"
|
15
|
+
autoload :Provider, "sparkle_formation/provider"
|
16
|
+
autoload :Resources, "sparkle_formation/resources"
|
17
|
+
autoload :Sparkle, "sparkle_formation/sparkle"
|
18
|
+
autoload :SparklePack, "sparkle_formation/sparkle"
|
19
|
+
autoload :SparkleCollection, "sparkle_formation/sparkle_collection"
|
20
|
+
autoload :SparkleAttribute, "sparkle_formation/sparkle_attribute"
|
21
|
+
autoload :SparkleStruct, "sparkle_formation/sparkle_struct"
|
22
|
+
autoload :TerraformStruct, "sparkle_formation/function_struct"
|
23
|
+
autoload :Utils, "sparkle_formation/utils"
|
24
|
+
autoload :Translation, "sparkle_formation/translation"
|
25
|
+
autoload :Version, "sparkle_formation/version"
|
26
26
|
end
|
27
27
|
|
28
|
-
require
|
28
|
+
require "sparkle_formation/sparkle_formation"
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
# Internal template composition
|
5
5
|
class Composition
|
6
6
|
|
7
7
|
# Component item of composition
|
8
|
-
Component = Struct.new(
|
8
|
+
Component = Struct.new("Component", :origin, :key, :block) do
|
9
9
|
def key
|
10
10
|
self[:key].to_s
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
# Override item of composition
|
15
|
-
Override = Struct.new(
|
15
|
+
Override = Struct.new("Override", :origin, :args, :block)
|
16
16
|
|
17
17
|
# @return [SparkleFormation] owner of composition
|
18
18
|
attr_reader :origin
|
@@ -26,7 +26,7 @@ class SparkleFormation
|
|
26
26
|
# @return [self]
|
27
27
|
def initialize(origin, args = {})
|
28
28
|
unless origin.is_a?(SparkleFormation)
|
29
|
-
raise TypeError.new
|
29
|
+
raise TypeError.new "Composition requires `SparkleFormation` instance as origin. " \
|
30
30
|
"Received origin type `#{origin.class}`."
|
31
31
|
end
|
32
32
|
@origin = origin
|
@@ -75,7 +75,7 @@ class SparkleFormation
|
|
75
75
|
when :prepend
|
76
76
|
components_list.unshift(item)
|
77
77
|
else
|
78
|
-
raise ArgumentError.new
|
78
|
+
raise ArgumentError.new "Unknown addition location provided. Valid: `:append, :prepend`. " \
|
79
79
|
"Received: `#{location.inspect}`"
|
80
80
|
end
|
81
81
|
end
|
@@ -97,7 +97,7 @@ class SparkleFormation
|
|
97
97
|
when :prepend
|
98
98
|
overrides_list.unshift(item)
|
99
99
|
else
|
100
|
-
raise ArgumentError.new
|
100
|
+
raise ArgumentError.new "Unknown addition location provided. Valid: " \
|
101
101
|
"`:append, :prepend`. Received: `#{location.inspect}`"
|
102
102
|
end
|
103
103
|
self
|
@@ -169,7 +169,7 @@ class SparkleFormation
|
|
169
169
|
end
|
170
170
|
unless valid_item
|
171
171
|
raise TypeError.new "Invalid type encountered within collection `#{item.class}`. " \
|
172
|
-
"Expected `#{type.map(&:to_s).join(
|
172
|
+
"Expected `#{type.map(&:to_s).join("`, `")}`."
|
173
173
|
end
|
174
174
|
end
|
175
175
|
items.dup
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -27,7 +27,7 @@ class SparkleFormation
|
|
27
27
|
if name
|
28
28
|
"Failed to locate item named: `#{name}`"
|
29
29
|
else
|
30
|
-
|
30
|
+
"Failed to locate item"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
|
@@ -91,7 +91,7 @@ class SparkleFormation
|
|
91
91
|
if args.empty?
|
92
92
|
super
|
93
93
|
else
|
94
|
-
@table[
|
94
|
+
@table["_function_"] = _klass_new(name, *args)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -115,7 +115,7 @@ class SparkleFormation
|
|
115
115
|
key, value = @table.first
|
116
116
|
suffix = _eval_join(
|
117
117
|
*[
|
118
|
-
key ==
|
118
|
+
key == "_function_" ? nil : key,
|
119
119
|
!value.nil? ? value._dump : nil,
|
120
120
|
].compact
|
121
121
|
)
|
@@ -132,7 +132,7 @@ class SparkleFormation
|
|
132
132
|
else
|
133
133
|
arg.inspect
|
134
134
|
end
|
135
|
-
end.join(
|
135
|
+
end.join(", ")
|
136
136
|
unless _fn_name.to_s.empty?
|
137
137
|
function_name = args.empty? ? "#{_fn_name}#{__empty_argument_list}" : "#{_fn_name}(#{args})"
|
138
138
|
end
|
@@ -165,7 +165,7 @@ class SparkleFormation
|
|
165
165
|
args = args.compact
|
166
166
|
args.delete_if &:empty?
|
167
167
|
args.slice(1, args.size).to_a.inject(args.first) do |memo, item|
|
168
|
-
if item.start_with?(
|
168
|
+
if item.start_with?("[")
|
169
169
|
memo += item
|
170
170
|
else
|
171
171
|
memo += ".#{item}"
|
@@ -189,17 +189,17 @@ class SparkleFormation
|
|
189
189
|
|
190
190
|
# @return [String] start character(s) used to anchor function call
|
191
191
|
def __anchor_start
|
192
|
-
|
192
|
+
"["
|
193
193
|
end
|
194
194
|
|
195
195
|
# @return [String] stop character(s) used to anchor function call
|
196
196
|
def __anchor_stop
|
197
|
-
|
197
|
+
"]"
|
198
198
|
end
|
199
199
|
|
200
200
|
# @return [String] value to use when argument list is empty
|
201
201
|
def __empty_argument_list
|
202
|
-
|
202
|
+
"()"
|
203
203
|
end
|
204
204
|
|
205
205
|
# @return [String] dump from root
|
@@ -239,9 +239,9 @@ class SparkleFormation
|
|
239
239
|
if _fn_context && _fn_context.root!.data![_fn_name] && _fn_context.root!.data![_fn_name].data![_fn_args.first]
|
240
240
|
__valid_keys = _fn_context.root!.data![_fn_name].data![_fn_args.first].keys!
|
241
241
|
__current_key = @table.keys.first
|
242
|
-
__match_key = __current_key.to_s.downcase.gsub(
|
242
|
+
__match_key = __current_key.to_s.downcase.gsub("_", "")
|
243
243
|
__key_remap = __valid_keys.detect do |__nested_key|
|
244
|
-
__nested_key.to_s.downcase.gsub(
|
244
|
+
__nested_key.to_s.downcase.gsub("_", "") == __match_key
|
245
245
|
end
|
246
246
|
if __key_remap
|
247
247
|
@table[__key_remap] = @table.delete(@table.keys.first)
|
@@ -261,17 +261,17 @@ class SparkleFormation
|
|
261
261
|
|
262
262
|
# @return [String] start character(s) used to anchor function call
|
263
263
|
def __anchor_start
|
264
|
-
|
264
|
+
"{{ "
|
265
265
|
end
|
266
266
|
|
267
267
|
# @return [String] stop character(s) used to anchor function call
|
268
268
|
def __anchor_stop
|
269
|
-
|
269
|
+
" }}"
|
270
270
|
end
|
271
271
|
|
272
272
|
# @return [String] value to use when argument list is empty
|
273
273
|
def __empty_argument_list
|
274
|
-
|
274
|
+
""
|
275
275
|
end
|
276
276
|
|
277
277
|
# @return [FalseClass] disable single quote string generation
|
@@ -290,17 +290,17 @@ class SparkleFormation
|
|
290
290
|
|
291
291
|
# @return [String] start character(s) used to anchor function call
|
292
292
|
def __anchor_start
|
293
|
-
|
293
|
+
"{% "
|
294
294
|
end
|
295
295
|
|
296
296
|
# @return [String] stop character(s) used to anchor function call
|
297
297
|
def __anchor_stop
|
298
|
-
|
298
|
+
" %}"
|
299
299
|
end
|
300
300
|
|
301
301
|
# @return [String] value to use when argument list is empty
|
302
302
|
def __empty_argument_list
|
303
|
-
|
303
|
+
""
|
304
304
|
end
|
305
305
|
|
306
306
|
# @return [FalseClass] disable single quote string generation
|
@@ -319,17 +319,17 @@ class SparkleFormation
|
|
319
319
|
|
320
320
|
# @return [String] start character(s) used to anchor function call
|
321
321
|
def __anchor_start
|
322
|
-
|
322
|
+
"$("
|
323
323
|
end
|
324
324
|
|
325
325
|
# @return [String] stop character(s) used to anchor function call
|
326
326
|
def __anchor_stop
|
327
|
-
|
327
|
+
")"
|
328
328
|
end
|
329
329
|
|
330
330
|
# @return [String] value to use when argument list is empty
|
331
331
|
def __empty_argument_list
|
332
|
-
|
332
|
+
""
|
333
333
|
end
|
334
334
|
|
335
335
|
# @return [FalseClass] disable single quote string generation
|
@@ -348,17 +348,17 @@ class SparkleFormation
|
|
348
348
|
|
349
349
|
# @return [String] start character(s) used to anchor function call
|
350
350
|
def __anchor_start
|
351
|
-
|
351
|
+
"${"
|
352
352
|
end
|
353
353
|
|
354
354
|
# @return [String] stop character(s) used to anchor function call
|
355
355
|
def __anchor_stop
|
356
|
-
|
356
|
+
"}"
|
357
357
|
end
|
358
358
|
|
359
359
|
# @return [String] value to use when argument list is empty
|
360
360
|
def __empty_argument_list
|
361
|
-
|
361
|
+
""
|
362
362
|
end
|
363
363
|
|
364
364
|
# @return [FalseClass] disable single quote string generation
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
# Provider specific implementation namespace
|
5
5
|
module Provider
|
6
|
-
autoload :Aws,
|
7
|
-
autoload :Azure,
|
8
|
-
autoload :Google,
|
9
|
-
autoload :Heat,
|
10
|
-
autoload :OpenStack,
|
11
|
-
autoload :Terraform,
|
6
|
+
autoload :Aws, "sparkle_formation/provider/aws"
|
7
|
+
autoload :Azure, "sparkle_formation/provider/azure"
|
8
|
+
autoload :Google, "sparkle_formation/provider/google"
|
9
|
+
autoload :Heat, "sparkle_formation/provider/heat"
|
10
|
+
autoload :OpenStack, "sparkle_formation/provider/heat"
|
11
|
+
autoload :Terraform, "sparkle_formation/provider/terraform"
|
12
12
|
end
|
13
13
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "sparkle_formation"
|
2
2
|
|
3
3
|
class SparkleFormation
|
4
4
|
module Provider
|
@@ -7,7 +7,7 @@ class SparkleFormation
|
|
7
7
|
|
8
8
|
# @return [String] Type string for AWS CFN stack resource
|
9
9
|
def stack_resource_type
|
10
|
-
|
10
|
+
"AWS::CloudFormation::Stack"
|
11
11
|
end
|
12
12
|
|
13
13
|
# Generate policy for stack
|
@@ -17,25 +17,25 @@ class SparkleFormation
|
|
17
17
|
statements = []
|
18
18
|
compile.resources.keys!.each do |r_name|
|
19
19
|
r_object = compile.resources[r_name]
|
20
|
-
if r_object[
|
21
|
-
r_object[
|
20
|
+
if r_object["Policy"]
|
21
|
+
r_object["Policy"].keys!.each do |effect|
|
22
22
|
statements.push(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
"Effect" => effect.to_s.capitalize,
|
24
|
+
"Action" => [r_object["Policy"][effect]].flatten.compact.map { |i| "Update:#{i}" },
|
25
|
+
"Resource" => "LogicalResourceId/#{r_name}",
|
26
|
+
"Principal" => "*",
|
27
27
|
)
|
28
28
|
end
|
29
|
-
r_object.delete!(
|
29
|
+
r_object.delete!("Policy")
|
30
30
|
end
|
31
31
|
end
|
32
32
|
statements.push(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
"Effect" => "Allow",
|
34
|
+
"Action" => "Update:*",
|
35
|
+
"Resource" => "*",
|
36
|
+
"Principal" => "*",
|
37
37
|
)
|
38
|
-
Smash.new(
|
38
|
+
Smash.new("Statement" => statements)
|
39
39
|
end
|
40
40
|
|
41
41
|
# Apply deeply nested stacks. This is the new nesting approach and
|
@@ -95,7 +95,7 @@ class SparkleFormation
|
|
95
95
|
if args.include?(:bubble_outputs)
|
96
96
|
outputs_hash = Hash[
|
97
97
|
output_map.map do |name, value|
|
98
|
-
[name, {
|
98
|
+
[name, {"Value" => {"Fn::GetAtt" => value}}]
|
99
99
|
end
|
100
100
|
]
|
101
101
|
unless compile.outputs.nil?
|
@@ -132,9 +132,9 @@ class SparkleFormation
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
raise ArgumentError.new "Failed to detect available bubbling path for output `#{output_name}`. " <<
|
135
|
-
|
136
|
-
"(Output Path: #{outputs[output_name].root_path.map(&:name).join(
|
137
|
-
"Requester Path: #{root_path.map(&:name).join(
|
135
|
+
"This may be due to a circular dependency! " <<
|
136
|
+
"(Output Path: #{outputs[output_name].root_path.map(&:name).join(" > ")} " <<
|
137
|
+
"Requester Path: #{root_path.map(&:name).join(" > ")})"
|
138
138
|
end
|
139
139
|
result = compile.attr!(bubble_path.first.name, "Outputs.#{output_name}")
|
140
140
|
if drip_path.size > 1
|
@@ -143,7 +143,7 @@ class SparkleFormation
|
|
143
143
|
drip_path.each_slice(2) do |base_sparkle, ref_sparkle|
|
144
144
|
next unless ref_sparkle
|
145
145
|
base_sparkle.compile.resources[ref_sparkle.name].properties.parameters.set!(output_name, result)
|
146
|
-
ref_sparkle.compile.parameters.set!(output_name) { type
|
146
|
+
ref_sparkle.compile.parameters.set!(output_name) { type "String" } # TODO: <<<<------ type check and prop
|
147
147
|
result = compile.ref!(output_name)
|
148
148
|
end
|
149
149
|
end
|
@@ -168,27 +168,27 @@ class SparkleFormation
|
|
168
168
|
stack_parameters = stack_resource.properties.stack.compile.parameters
|
169
169
|
unless stack_parameters.nil?
|
170
170
|
stack_parameters._dump.each do |pname, pval|
|
171
|
-
if pval[
|
171
|
+
if pval["StackUnique"]
|
172
172
|
check_name = [stack_name, pname].join
|
173
173
|
else
|
174
174
|
check_name = pname
|
175
175
|
end
|
176
176
|
if parameters.keys.include?(check_name)
|
177
|
-
if list_type?(parameters[check_name][
|
178
|
-
new_val = {
|
177
|
+
if list_type?(parameters[check_name]["Type"])
|
178
|
+
new_val = {"Fn::Join" => [",", {"Ref" => check_name}]}
|
179
179
|
else
|
180
|
-
new_val = {
|
180
|
+
new_val = {"Ref" => check_name}
|
181
181
|
end
|
182
182
|
template.resources.set!(stack_name).properties.parameters.set!(pname, new_val)
|
183
183
|
elsif output_map[check_name]
|
184
184
|
template.resources.set!(stack_name).properties.parameters.set!(
|
185
|
-
pname,
|
185
|
+
pname, "Fn::GetAtt" => output_map[check_name],
|
186
186
|
)
|
187
187
|
else
|
188
|
-
if list_type?(pval[
|
189
|
-
new_val = {
|
188
|
+
if list_type?(pval["Type"])
|
189
|
+
new_val = {"Fn::Join" => [",", {"Ref" => check_name}]}
|
190
190
|
else
|
191
|
-
new_val = {
|
191
|
+
new_val = {"Ref" => check_name}
|
192
192
|
end
|
193
193
|
template.resources.set!(stack_name).properties.parameters.set!(pname, new_val)
|
194
194
|
parameters[check_name] = pval
|
@@ -208,7 +208,7 @@ class SparkleFormation
|
|
208
208
|
# @param type [String]
|
209
209
|
# @return [TrueClass, FalseClass]
|
210
210
|
def list_type?(type)
|
211
|
-
type ==
|
211
|
+
type == "CommaDelimitedList" || type.start_with?("List<")
|
212
212
|
end
|
213
213
|
end
|
214
214
|
end
|