pangea 0.0.56 → 0.0.57

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
  SHA256:
3
- metadata.gz: 3a69524c078cad00d8ce495a0dd88eb00d8aaaea346b87202b2218753df571b3
4
- data.tar.gz: a4eaaeec3c58531ec9f74f23361c3daa8fe54c7ff1fec545032be7cc57002c2d
3
+ metadata.gz: b67384b1e67ddd2e0ce27af66f4e84cbb477eb9ca4c7d7441f347379a53664a6
4
+ data.tar.gz: 660bad90a7ad11eeea0efcba6cebb195d4b033ad5f1687f244e9b7323a6d5442
5
5
  SHA512:
6
- metadata.gz: f0a5d8bc081e365896099936b0bed3cd60f9ed719e43918292621b86092ae9239b1a57a69d56d66c69d19c5ff3cbcbdfaa647e067c3b111d866d0d71e2dfd767
7
- data.tar.gz: d0e38afe59f2d70e4c17fc474342c96f4046daadfa9f96d5799b4348031d89526c7e6f69e929dc1f198d09fefb98ac34f9032b8d01a2481f821369d639d9ce13
6
+ metadata.gz: 859e4081b558250b3c130c4d23cf45a4d9f631cb0545e75facb6ef83129f8841c9a9afdaf115b8a3cc7f58ede4e6ff124ca2cf9b3da12e6305475a65b61583ea
7
+ data.tar.gz: dbc9e49f912a86066c05a9e6f6ddc78605cdb745614b57addd9e538222a066dc21bc6cb356cd428b6ce70d670db50db0108b28ae085bbbf69492b007368e4140
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pangea (0.0.56)
4
+ pangea (0.0.57)
5
5
  abstract-synthesizer
6
6
  aws-sdk-dynamodb
7
7
  aws-sdk-s3
@@ -127,7 +127,7 @@ GEM
127
127
  rbs (>= 3, < 5)
128
128
  sorbet-runtime (>= 0.5.10782)
129
129
  ruby-progressbar (1.13.0)
130
- sorbet-runtime (0.5.12167)
130
+ sorbet-runtime (0.5.12174)
131
131
  stringio (3.1.7)
132
132
  strings (0.2.1)
133
133
  strings-ansi (~> 0.2)
data/gemset.nix CHANGED
@@ -254,7 +254,7 @@
254
254
  path = ./.;
255
255
  type = "path";
256
256
  };
257
- version = "0.0.56";
257
+ version = "0.0.57";
258
258
  };
259
259
  parallel = {
260
260
  groups = ["default" "development"];
@@ -537,10 +537,10 @@
537
537
  platforms = [];
538
538
  source = {
539
539
  remotes = ["https://rubygems.org"];
540
- sha256 = "029irlivbgfc2j7jlrpd7bpsh4nkcq5zqmyfs0p6j9nii7kn2dz3";
540
+ sha256 = "09zjmrbdk0rb3v23n5xsc0lzgsh2mc0wi32ig7rqvslc7k6b0pk6";
541
541
  type = "gem";
542
542
  };
543
- version = "0.5.12167";
543
+ version = "0.5.12174";
544
544
  };
545
545
  stringio = {
546
546
  groups = ["default" "development"];
@@ -12,7 +12,6 @@ module Pangea
12
12
  def register_action(action)
13
13
  permitted_actions = %i[plan apply show destroy]
14
14
  @action = action if permitted_actions.map(&:to_s).include?(action.to_s)
15
- @action = 'plan' if @action.nil?
16
15
  end
17
16
 
18
17
  def process(content)
@@ -84,9 +83,13 @@ module Pangea
84
83
  )
85
84
  )
86
85
 
87
- system("cd #{local_cache} && #{bin} apply -auto-approve") if @action.to_s.eql?('apply')
88
- system("cd #{local_cache} && #{bin} plan") if @action.to_s.eql?('plan')
89
- system("cd #{local_cache} && #{bin} destroy -auto-approve") if @action.to_s.eql?('destroy')
86
+ if @action.to_s == 'apply'
87
+ system "cd #{local_cache} && #{bin} apply -auto-approve"
88
+ elsif @action.to_s == 'plan'
89
+ system "cd #{local_cache} && #{bin} plan"
90
+ elsif @action.to_s == 'destroy'
91
+ system "cd #{local_cache} && #{bin} destroy -auto-approve"
92
+ end
90
93
 
91
94
  template = Pangea::Utils.symbolize(
92
95
  JSON[File.read(
@@ -63,7 +63,6 @@ module Pangea
63
63
  resource_name = synthesizer.synthesis[:resource][synthesizer.synthesis[:resource].keys[0]].keys[0]
64
64
  dir = File.join(init_dir, resource_type.to_s, resource_name.to_s)
65
65
  create_prepped_state_directory(dir, synthesizer.synthesis)
66
- system %(cd #{dir} && #{BIN} show -json tfplan > plan.json)
67
66
  system %(cd #{dir} && #{BIN} apply -auto-approve)
68
67
 
69
68
  synthesizer.clear_synthesis!
@@ -82,160 +81,5 @@ module Pangea
82
81
  @synthesizer ||= TerraformSynthesizer.new
83
82
  end
84
83
  end
85
-
86
- # BIN = %(tofu).freeze
87
-
88
- # attr_reader :namespace
89
-
90
- # def initialize
91
- # raise ArgumentError, 'provide PANGEA_NAMESPACE ENVVAR' if ENV.fetch('PANGEA_NAMESPACE').nil?
92
- #
93
- # @namespace = ENV.fetch('PANGEA_NAMESPACE', nil)
94
- # end
95
-
96
- # def config
97
- # @config ||= Pangea::Utils.symbolize(
98
- # Pangea::Config.config
99
- # )
100
- # end
101
-
102
- # def s3
103
- # @s3 = Aws::S3::Client.new
104
- # end
105
-
106
- # def verify_state(state)
107
- # raise Argumenterror, 'must have a bucket' unless state[:config][:bucket]
108
- # raise Argumenterror, 'must have a region' unless state[:config][:region]
109
- # raise Argumenterror, 'must have a lock' unless state[:config][:lock]
110
- # end
111
-
112
- # def pangea_home
113
- # %(#{Dir.home}/.pangea/#{namespace})
114
- # end
115
-
116
- # def bin
117
- # %(tofu)
118
- # end
119
-
120
- # def selected_namespace_configuration
121
- # sns = ''
122
- # config[:namespaces].each_key do |ns|
123
- # sns = config[:namespaces][ns] if ns.to_s.eql?(namespace.to_s)
124
- # end
125
- # @selected_namespace_configuration ||= sns
126
- # end
127
-
128
- # render things in a resource context
129
- # without using terraform modules
130
- # def state(name, &block)
131
- # if block.nil?
132
- # File.write(File.join(local_cache, 'main.tf.json'), JSON[{}])
133
- # system("cd #{local_cache} && #{bin} init -input=false")
134
- # system("cd #{local_cache} && #{bin} plan")
135
- # system("cd #{local_cache} && #{bin} apply -auto-approve")
136
- # return {}
137
- # end
138
- # S3Renderer.synthesizer.synthesize(&block)
139
- # synth = Pangea::Utils.symbolize(S3Renderer.synthesizer.synthesis)
140
- # prefix = "#{name}/pangea"
141
- # local_cache = File.join(pangea_home, prefix)
142
- # `mkdir -p #{local_cache}` unless Dir.exist?(local_cache)
143
- # sns = selected_namespace_configuration
144
- # verify_state(sns[:state])
145
- #
146
- # # apply state configuration
147
- # unless synth[:terraform]
148
- # S3Renderer.synthesizer.synthesize do
149
- # terraform do
150
- # backend(
151
- # s3: {
152
- # key: prefix,
153
- # dynamodb_table: sns[:state][:config][:lock].to_s,
154
- # bucket: sns[:state][:config][:bucket].to_s,
155
- # region: sns[:state][:config][:region].to_s,
156
- # encrypt: true
157
- # }
158
- # )
159
- # end
160
- # end
161
- # end
162
- #
163
- # File.write(File.join(local_cache, 'main.tf.json'), JSON[S3Renderer.synthesizer.synthesis])
164
- # template = Pangea::Utils.symbolize(JSON[File.read(File.join(local_cache, 'main.tf.json'))])
165
- # system("cd #{local_cache} && #{bin} init -input=false")
166
- # system("cd #{local_cache} && #{bin} plan")
167
- # system("cd #{local_cache} && #{bin} apply -auto-approve")
168
- # # puts s3.list_objects_v2(bucket: sns[:state][:config][:bucket], prefix: prefix).contents.map(&:key)
169
- # { template: template }
170
- # end
171
-
172
- # def state_keys
173
- # sns = selected_namespace_configuration
174
- # end
175
-
176
- # def state; end
177
-
178
- # def render_component(template)
179
- # mod = 'stump'
180
- # sns = ''
181
- # config[:namespaces].each_key do |ns|
182
- # sns = config[:namespaces][ns] if ns.to_s.eql?(namespace.to_s)
183
- # end
184
- #
185
- # unless sns[:state][:type].to_s.eql?('s3')
186
- # raise ArgumentError,
187
- # 'state type must be s3 '
188
- # end
189
- #
190
- # if sns.nil? || sns.empty?
191
- # raise ArgumentError,
192
- # "namespace #{namespace} not found in #{Pangea::Utils.pretty(config)}"
193
- # end
194
- #
195
- # synthesizer.synthesize(template)
196
- # syn = Pangea::Utils.symbolize(synthesizer.synthesis)
197
- # raise ArgumentError, 'must provide at least one resource' if syn[:resource].nil?
198
- #
199
- # resource_name = syn[:resource].keys[0]
200
- # virtual_name = syn[:resource][syn[:resource].keys[0]].keys[0]
201
- #
202
- # synthesizer.synthesize do
203
- # provider do
204
- # aws(region: sns[:state][:config][:region].to_s)
205
- # end
206
- # variable do
207
- # name(type: 'string', description: 'the module name')
208
- # end
209
- # end
210
- #
211
- # synthesizer.synthesize do
212
- # terraform do
213
- # backend(
214
- # s3: {
215
- # key: "#{sns[:name]}/#{mod}/#{resource_name}/#{virtual_name}/module",
216
- # dynamodb_table: sns[:state][:config][:lock].to_s,
217
- # bucket: sns[:state][:config][:bucket].to_s,
218
- # region: sns[:state][:config][:region].to_s,
219
- # encrypt: true
220
- # }
221
- # )
222
- # end
223
- # end
224
- #
225
- # # modcache_address = "#{sns[:name]}/#{mod}/#{resource_name}/#{virtual_name}/module"
226
- #
227
- # # create the modcache directory
228
- # modcache = Pangea::ModCache.new(
229
- # sns[:name],
230
- # mod,
231
- # resource_name,
232
- # virtual_name
233
- # )
234
- # # place the internal module
235
- # modcache.place_internal_module(syn)
236
- # modcache.place_caller_template
237
- #
238
- # Pangea::Utils.symbolize(synthesizer.synthesis)
239
- # end
240
84
  end
241
85
  end
@@ -1,3 +1,3 @@
1
1
  module Pangea
2
- VERSION = %(0.0.56).freeze
2
+ VERSION = %(0.0.57).freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pangea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.56
4
+ version: 0.0.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - drzthslnt@gmail.com