terraform-synthesizer 0.0.14 → 0.0.15
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/lib/terraform-synthesizer/version.rb +1 -1
- data/lib/terraform-synthesizer.rb +1 -11
- data/spec/terraform_spec.rb +19 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1ef503dbcd7c796cda35e508798623fe1ba26202138df278dc56df6ffcc305a
|
4
|
+
data.tar.gz: 64b3bbb65508243e2294eb11ab67474e7741c3e2023ef56a64a36fd06a4cb6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4542a100e11a81e55128c86b28849e0b106a38e33bc44a166c965be43290c7e4b27fd4d45985899b603639a708a22e06d82683912052daab3df299b3583a5bad
|
7
|
+
data.tar.gz: 2458e557e8e0ea60ec7782e4ab027ebe32fb8d8b16f08c8de53b7c35b357dfb952ce39501f96ce5cea3fb317e76639ac0c8a3f2b14c5a80e2ac811f1deed3550
|
@@ -11,28 +11,18 @@ class TerraformSynthesizer < AbstractSynthesizer
|
|
11
11
|
|
12
12
|
def method_missing(method_name, *args, &)
|
13
13
|
if @in_locals
|
14
|
-
puts %(processing local variable #{method_name})
|
15
|
-
puts %(processing local variable value #{args[0]})
|
16
14
|
if args[0].nil?
|
17
15
|
raise ArgumentError,
|
18
16
|
%(not assigning anything to this local #{method_name})
|
19
17
|
end
|
20
18
|
|
21
19
|
@in_locals = false
|
22
|
-
@translation[:template][:locals].
|
23
|
-
{ method_name.to_sym => args[0] }
|
24
|
-
)
|
20
|
+
@translation[:template][:locals][method_name.to_sym] = args[0]
|
25
21
|
elsif method_name.to_s.eql?(%(locals))
|
26
|
-
puts %(caught local execution start)
|
27
|
-
|
28
22
|
@translation = {} if @translation.nil?
|
29
|
-
puts @translation
|
30
23
|
@translation[:template] = {} if @translation[:template].nil?
|
31
|
-
puts @translation
|
32
24
|
@translation[:template][:locals] = {} if @translation[:template][:locals].nil?
|
33
|
-
puts @translation
|
34
25
|
@in_locals = true
|
35
|
-
puts @translation
|
36
26
|
yield
|
37
27
|
else
|
38
28
|
abstract_method_missing(
|
data/spec/terraform_spec.rb
CHANGED
@@ -36,10 +36,13 @@ describe TerraformSynthesizer do
|
|
36
36
|
expect(synth.synthesis[:locals][:special_var]).to be_kind_of(String)
|
37
37
|
end
|
38
38
|
|
39
|
-
it %(should contain
|
39
|
+
it %(should contain resource thing) do
|
40
40
|
synth.synthesize do
|
41
41
|
resource :aws_vpc, :thing do
|
42
42
|
cidr_block %(10.0.0.0/16)
|
43
|
+
stuff do
|
44
|
+
other_stuff %(whoa)
|
45
|
+
end
|
43
46
|
end
|
44
47
|
locals do
|
45
48
|
special_var %(special_value)
|
@@ -50,5 +53,20 @@ describe TerraformSynthesizer do
|
|
50
53
|
end
|
51
54
|
expect(synth.synthesis[:resource][:aws_vpc][:thing]).to be_kind_of(Hash)
|
52
55
|
end
|
56
|
+
|
57
|
+
it %(should contain resource thang) do
|
58
|
+
synth.synthesize do
|
59
|
+
resource :aws_vpc, :thing do
|
60
|
+
cidr_block %(10.0.0.0/16)
|
61
|
+
end
|
62
|
+
locals do
|
63
|
+
special_var %(special_value)
|
64
|
+
end
|
65
|
+
resource :aws_vpc, :thang do
|
66
|
+
cidr_block %(10.0.0.0/16)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
expect(synth.synthesis[:resource][:aws_vpc][:thang]).to be_kind_of(Hash)
|
70
|
+
end
|
53
71
|
end
|
54
72
|
end
|