terraform-synthesizer 0.0.20 → 0.0.22

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
  SHA256:
3
- metadata.gz: f50786c1639887e0775bcaa7c31060ac2aa8bbd3b5d31f0265671294f8b8a9d6
4
- data.tar.gz: 6d990987d5b7eb33109bac60ee3ecf489e5390d05efde071fad51c11bbd63cd1
3
+ metadata.gz: d14d574d872c1ac1022a494d9372734fc616f296d8bcb0aecbb2e047688eec02
4
+ data.tar.gz: 11e5d148dbcb7098c6b5ac2486bd9ec259a634a47967af32c9dde2465f709a25
5
5
  SHA512:
6
- metadata.gz: 21590006be096774dfdcbc7621cc1a6aa8d25496f663e7e100f7cd4f4228e669dffc5a9ea8c82744165eb03f10b21f231e6143423891703b39b34c96309132ce
7
- data.tar.gz: 992956bbff976070436355896212d88075f6458fdd8c836329f51d885a1c79095e5063ab4b4eb87d1d697091995b4c6a2904472c7cacf8709c7ee41307cbf05a
6
+ metadata.gz: d5fe4bb12900049eb30fae229cc92afdacae4d4d774095429a839688bed8cc5f1e7e480d80174a03819f0a4d055886bd272aa902b19bfb7a4f82d050fdf22c94
7
+ data.tar.gz: 4912d72d0f65b7857955e157537cadb5b41162a3e9d1ea788647ce9c1527d61f8a63214f0f894826f2e37c6c90332ebc668ccef7d876d2e952dc9dcfe9437b88
data/Gemfile.lock CHANGED
@@ -44,7 +44,7 @@ GEM
44
44
  diff-lcs (>= 1.2.0, < 2.0)
45
45
  rspec-support (~> 3.12.0)
46
46
  rspec-support (3.12.1)
47
- rubocop (1.57.2)
47
+ rubocop (1.58.0)
48
48
  json (~> 2.3)
49
49
  language_server-protocol (>= 3.17.0)
50
50
  parallel (~> 1.10)
@@ -52,7 +52,7 @@ GEM
52
52
  rainbow (>= 2.2.2, < 4.0)
53
53
  regexp_parser (>= 1.8, < 3.0)
54
54
  rexml (>= 3.2.5, < 4.0)
55
- rubocop-ast (>= 1.28.1, < 2.0)
55
+ rubocop-ast (>= 1.30.0, < 2.0)
56
56
  ruby-progressbar (~> 1.7)
57
57
  unicode-display_width (>= 2.4.0, < 3.0)
58
58
  rubocop-ast (1.30.0)
@@ -1,3 +1,3 @@
1
1
  module TerraformSynthesizer
2
- VERSION = %(0.0.20).freeze
2
+ VERSION = %(0.0.22).freeze
3
3
  end
@@ -2,57 +2,20 @@ require %(abstract-synthesizer)
2
2
 
3
3
  class TerraformSynthesizer < AbstractSynthesizer
4
4
  RESOURCE_KEYS = %i[
5
+ terraform
6
+ provider
5
7
  resource
6
8
  variable
9
+ locals
7
10
  output
8
11
  data
9
12
  ].freeze
10
13
 
11
- # if there are additional block keys
12
- # add them here and they should be processed
13
- # accordingly
14
- BLOCK_KEYS = %i[locals terraform].freeze
15
-
16
- ##############################################################################
17
- # notes:
18
- #
19
- # locals are processed as a direct block like
20
- # locals do
21
- # key value
22
- # end
23
- # while resources are processed as resource like blocks
24
- # resource :aws_vpc, :virtual_name do
25
- # key value
26
- # end
27
- ##############################################################################
28
- def method_missing(method_name, *args, &)
29
- BLOCK_KEYS.each do |block_key|
30
- if @in_block_key
31
- if args[0].nil? || args[0].empty?
32
- raise ArgumentError,
33
- %(not assigning anything to this #{block_key})
34
- end
35
-
36
- @in_block_key = false
37
- @translation[:template][block_key.to_sym][method_name.to_sym] = args[0]
38
-
39
- elsif method_name.to_s.eql?(block_key.to_s)
40
-
41
- @translation = {} if @translation.nil?
42
- @translation[:template] = {} if @translation[:template].nil?
43
- @translation[:template][block_key.to_sym] = {} \
44
- if @translation[:template][block_key.to_sym].nil?
45
- @in_block_key = true
46
-
47
- yield
48
- else
49
- abstract_method_missing(
50
- method_name.to_sym,
51
- RESOURCE_KEYS,
52
- *args,
53
- &
54
- )
55
- end
56
- end
14
+ def method_missing(method_name, ...)
15
+ abstract_method_missing(
16
+ method_name.to_sym,
17
+ RESOURCE_KEYS,
18
+ ...
19
+ )
57
20
  end
58
21
  end
@@ -6,43 +6,37 @@ describe TerraformSynthesizer do
6
6
  described_class.new
7
7
  end
8
8
 
9
- it %(should compile small declaration and be hash) do
9
+ it %(should contain resource thing) do
10
10
  synth.synthesize do
11
11
  resource :aws_vpc, :thing do
12
12
  cidr_block %(10.0.0.0/16)
13
- end
14
- locals do
15
- special_var %(special_value)
13
+ stuff do
14
+ other_stuff %(whoa)
15
+ end
16
16
  end
17
17
  resource :aws_vpc, :thang do
18
18
  cidr_block %(10.0.0.0/16)
19
19
  end
20
20
  end
21
- expect(synth.synthesis).to be_kind_of(Hash)
21
+ expect(synth.synthesis[:resource][:aws_vpc][:thing]).to be_kind_of(Hash)
22
22
  end
23
23
 
24
- it %(should contain locals) do
24
+ it %(should compile small declaration and be hash) do
25
25
  synth.synthesize do
26
26
  resource :aws_vpc, :thing do
27
27
  cidr_block %(10.0.0.0/16)
28
28
  end
29
- locals do
30
- special_var %(special_value)
31
- end
32
29
  resource :aws_vpc, :thang do
33
30
  cidr_block %(10.0.0.0/16)
34
31
  end
35
32
  end
36
- expect(synth.synthesis[:locals][:special_var]).to be_kind_of(String)
33
+ expect(synth.synthesis).to be_kind_of(Hash)
37
34
  end
38
35
 
39
- it %(should contain resource thing) do
36
+ it %(should contain locals) do
40
37
  synth.synthesize do
41
38
  resource :aws_vpc, :thing do
42
39
  cidr_block %(10.0.0.0/16)
43
- stuff do
44
- other_stuff %(whoa)
45
- end
46
40
  end
47
41
  locals do
48
42
  special_var %(special_value)
@@ -51,7 +45,7 @@ describe TerraformSynthesizer do
51
45
  cidr_block %(10.0.0.0/16)
52
46
  end
53
47
  end
54
- expect(synth.synthesis[:resource][:aws_vpc][:thing]).to be_kind_of(Hash)
48
+ expect(synth.synthesis[:locals][:special_var]).to be_kind_of(String)
55
49
  end
56
50
 
57
51
  it %(should contain resource thang) do
@@ -68,5 +62,15 @@ describe TerraformSynthesizer do
68
62
  end
69
63
  expect(synth.synthesis[:resource][:aws_vpc][:thang]).to be_kind_of(Hash)
70
64
  end
65
+
66
+ it %(should return provider) do
67
+ synth.synthesize do
68
+ provider :datadog do
69
+ api_key %(api key value)
70
+ app_key %(app key value)
71
+ end
72
+ end
73
+ expect(synth.synthesis[:provider]).to be_kind_of(Hash)
74
+ end
71
75
  end
72
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraform-synthesizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - drzthslnt@gmail.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-01 00:00:00.000000000 Z
11
+ date: 2023-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abstract-synthesizer