rake_terraform 1.12.0.pre.1 → 1.16.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory'
2
4
  require 'ruby_terraform'
3
5
  require 'ostruct'
@@ -7,16 +9,16 @@ module RakeTerraform
7
9
  module Tasks
8
10
  class Provision < RakeFactory::Task
9
11
  default_name :provision
10
- default_prerequisites RakeFactory::DynamicValue.new { |t|
12
+ default_prerequisites(RakeFactory::DynamicValue.new do |t|
11
13
  [t.ensure_task_name]
12
- }
13
- default_description RakeFactory::DynamicValue.new { |t|
14
+ end)
15
+ default_description(RakeFactory::DynamicValue.new do |t|
14
16
  "Provision #{t.configuration_name} using terraform"
15
- }
17
+ end)
16
18
 
17
- parameter :configuration_name, :required => true
18
- parameter :source_directory, :required => true
19
- parameter :work_directory, :required => true
19
+ parameter :configuration_name, required: true
20
+ parameter :source_directory, required: true
21
+ parameter :work_directory, required: true
20
22
 
21
23
  parameter :backend_config
22
24
 
@@ -24,42 +26,51 @@ module RakeTerraform
24
26
  parameter :var_file
25
27
  parameter :state_file
26
28
 
27
- parameter :debug, :default => false
28
- parameter :no_color, :default => false
29
- parameter :no_backup, :default => false
29
+ parameter :debug, default: false
30
+ parameter :input, default: false
31
+ parameter :no_color, default: false
32
+ parameter :no_backup, default: false
30
33
 
31
34
  parameter :backup_file
32
35
 
33
- parameter :ensure_task_name, :default => :'terraform:ensure'
36
+ parameter :ensure_task_name, default: :'terraform:ensure'
37
+
38
+ # rubocop:disable Metrics/BlockLength
34
39
 
35
40
  action do |t|
36
41
  Colored2.disable! if t.no_color
37
42
 
43
+ module_directory =
44
+ File.join(FileUtils.pwd, t.source_directory)
38
45
  configuration_directory =
39
- File.join(t.work_directory, t.source_directory)
46
+ File.join(t.work_directory, t.source_directory)
40
47
 
41
- puts "Provisioning #{t.configuration_name}".cyan
42
- RubyTerraform.clean(
43
- directory: configuration_directory)
48
+ Kernel.puts("Provisioning #{t.configuration_name}".cyan)
44
49
 
45
- mkdir_p File.dirname(configuration_directory)
46
- cp_r t.source_directory, configuration_directory
50
+ FileUtils.rm_rf(configuration_directory)
51
+ FileUtils.mkdir_p(configuration_directory)
47
52
 
48
-
49
- Dir.chdir(configuration_directory) do
50
- RubyTerraform.init(
51
- backend_config: t.backend_config,
52
- no_color: t.no_color)
53
- RubyTerraform.apply(
54
- auto_approve: true,
55
- no_color: t.no_color,
56
- no_backup: t.no_backup,
57
- backup: t.backup_file,
58
- state: t.state_file,
59
- vars: t.vars,
60
- var_file: t.var_file)
61
- end
53
+ RubyTerraform.init(
54
+ chdir: configuration_directory,
55
+ from_module: module_directory,
56
+ backend_config: t.backend_config,
57
+ no_color: t.no_color,
58
+ input: t.input
59
+ )
60
+ RubyTerraform.apply(
61
+ chdir: configuration_directory,
62
+ auto_approve: true,
63
+ input: t.input,
64
+ no_color: t.no_color,
65
+ no_backup: t.no_backup,
66
+ backup: t.backup_file,
67
+ state: t.state_file,
68
+ vars: t.vars,
69
+ var_file: t.var_file
70
+ )
62
71
  end
72
+
73
+ # rubocop:enable Metrics/BlockLength
63
74
  end
64
75
  end
65
76
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory'
2
4
  require 'ruby_terraform'
3
5
  require 'ostruct'
@@ -7,51 +9,49 @@ module RakeTerraform
7
9
  module Tasks
8
10
  class Validate < RakeFactory::Task
9
11
  default_name :validate
10
- default_prerequisites RakeFactory::DynamicValue.new { |t|
12
+ default_prerequisites(RakeFactory::DynamicValue.new do |t|
11
13
  [t.ensure_task_name]
12
- }
13
- default_description RakeFactory::DynamicValue.new { |t|
14
+ end)
15
+ default_description(RakeFactory::DynamicValue.new do |t|
14
16
  "Validate #{t.configuration_name} using terraform"
15
- }
17
+ end)
16
18
 
17
- parameter :configuration_name, :required => true
18
- parameter :source_directory, :required => true
19
- parameter :work_directory, :required => true
19
+ parameter :configuration_name, required: true
20
+ parameter :source_directory, required: true
21
+ parameter :work_directory, required: true
20
22
 
21
23
  parameter :backend_config
22
24
 
23
- parameter :vars, default: {}
24
- parameter :var_file
25
- parameter :state_file
26
-
27
- parameter :debug, :default => false
28
- parameter :no_color, :default => false
25
+ parameter :debug, default: false
26
+ parameter :input, default: false
27
+ parameter :no_color, default: false
29
28
 
30
- parameter :ensure_task_name, :default => :'terraform:ensure'
29
+ parameter :ensure_task_name, default: :'terraform:ensure'
31
30
 
32
31
  action do |t|
33
32
  Colored2.disable! if t.no_color
34
33
 
34
+ module_directory =
35
+ File.join(FileUtils.pwd, t.source_directory)
35
36
  configuration_directory =
36
- File.join(t.work_directory, t.source_directory)
37
-
38
- puts "Validating #{t.configuration_name}".cyan
39
- RubyTerraform.clean(
40
- directory: configuration_directory)
41
-
42
- mkdir_p File.dirname(configuration_directory)
43
- cp_r t.source_directory, configuration_directory
44
-
45
- Dir.chdir(configuration_directory) do
46
- RubyTerraform.init(
47
- backend_config: t.backend_config,
48
- no_color: t.no_color)
49
- RubyTerraform.validate(
50
- no_color: t.no_color,
51
- state: t.state_file,
52
- vars: t.vars,
53
- var_file: t.var_file)
54
- end
37
+ File.join(t.work_directory, t.source_directory)
38
+
39
+ Kernel.puts("Validating #{t.configuration_name}".cyan)
40
+
41
+ FileUtils.rm_rf(configuration_directory)
42
+ FileUtils.mkdir_p(configuration_directory)
43
+
44
+ RubyTerraform.init(
45
+ chdir: configuration_directory,
46
+ from_module: module_directory,
47
+ backend_config: t.backend_config,
48
+ no_color: t.no_color,
49
+ input: t.input
50
+ )
51
+ RubyTerraform.validate(
52
+ chdir: configuration_directory,
53
+ no_color: t.no_color
54
+ )
55
55
  end
56
56
  end
57
57
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RakeTerraform
2
- VERSION = "1.12.0.pre.1"
4
+ VERSION = '1.16.0.pre.2'
3
5
  end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'rake_terraform/version'
6
+
7
+ files = %w[
8
+ bin
9
+ lib
10
+ CODE_OF_CONDUCT.md
11
+ rake_terraform.gemspec
12
+ Gemfile
13
+ LICENSE.txt
14
+ Rakefile
15
+ README.md
16
+ ]
17
+
18
+ Gem::Specification.new do |spec|
19
+ spec.name = 'rake_terraform'
20
+ spec.version = RakeTerraform::VERSION
21
+ spec.authors = ['Toby Clemson']
22
+ spec.email = ['tobyclemson@gmail.com']
23
+
24
+ spec.summary = 'Rake tasks for running terraform.'
25
+ spec.description =
26
+ 'Provides rake tasks for executing terraform commands as part of a ' \
27
+ 'rake build.'
28
+ spec.homepage = 'https://github.com/infrablocks/rake_terraform'
29
+ spec.license = 'MIT'
30
+
31
+ spec.files = `git ls-files -z`.split("\x0").select do |f|
32
+ f.match(/^(#{files.map { |g| Regexp.escape(g) }.join('|')})/)
33
+ end
34
+ spec.bindir = 'exe'
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ['lib']
37
+
38
+ spec.required_ruby_version = '>= 2.6'
39
+
40
+ spec.add_dependency 'colored2', '~> 3.1'
41
+ spec.add_dependency 'rake_dependencies', '~> 2.9'
42
+ spec.add_dependency 'rake_factory', '~> 0.23'
43
+ spec.add_dependency 'ruby-terraform', '~> 1.1'
44
+
45
+ spec.add_development_dependency 'activesupport', '~> 5.2'
46
+ spec.add_development_dependency 'bundler', '~> 2.0'
47
+ spec.add_development_dependency 'fakefs', '~> 0.18'
48
+ spec.add_development_dependency 'gem-release', '~> 2.1'
49
+ spec.add_development_dependency 'guard', '~> 2.16'
50
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
51
+ spec.add_development_dependency 'rake', '~> 13.0'
52
+ spec.add_development_dependency 'rake_circle_ci', '~> 0.9'
53
+ spec.add_development_dependency 'rake_github', '~> 0.5'
54
+ spec.add_development_dependency 'rake_gpg', '~> 0.12'
55
+ spec.add_development_dependency 'rake_ssh', '~> 0.4'
56
+ spec.add_development_dependency 'rspec', '~> 3.9'
57
+ spec.add_development_dependency 'rubocop', '~> 1.12'
58
+ spec.add_development_dependency 'rubocop-rake', '~> 0.5'
59
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
60
+ spec.add_development_dependency 'simplecov', '~> 0.21'
61
+ spec.add_development_dependency 'yard', '~> 0.9'
62
+ end
metadata CHANGED
@@ -1,89 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0.pre.1
4
+ version: 1.16.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-02 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake_dependencies
14
+ name: colored2
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3'
19
+ version: '3.1'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '2'
30
- - - "<"
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake_dependencies
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.9'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
31
39
  - !ruby/object:Gem::Version
32
- version: '3'
40
+ version: '2.9'
33
41
  - !ruby/object:Gem::Dependency
34
42
  name: rake_factory
35
43
  requirement: !ruby/object:Gem::Requirement
36
44
  requirements:
37
- - - ">="
45
+ - - "~>"
38
46
  - !ruby/object:Gem::Version
39
47
  version: '0.23'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '1'
43
48
  type: :runtime
44
49
  prerelease: false
45
50
  version_requirements: !ruby/object:Gem::Requirement
46
51
  requirements:
47
- - - ">="
52
+ - - "~>"
48
53
  - !ruby/object:Gem::Version
49
54
  version: '0.23'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '1'
53
55
  - !ruby/object:Gem::Dependency
54
56
  name: ruby-terraform
55
57
  requirement: !ruby/object:Gem::Requirement
56
58
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: '0.62'
60
- - - "<"
59
+ - - "~>"
61
60
  - !ruby/object:Gem::Version
62
- version: '1'
61
+ version: '1.1'
63
62
  type: :runtime
64
63
  prerelease: false
65
64
  version_requirements: !ruby/object:Gem::Requirement
66
65
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0.62'
70
- - - "<"
66
+ - - "~>"
71
67
  - !ruby/object:Gem::Version
72
- version: '1'
68
+ version: '1.1'
73
69
  - !ruby/object:Gem::Dependency
74
- name: colored2
70
+ name: activesupport
75
71
  requirement: !ruby/object:Gem::Requirement
76
72
  requirements:
77
73
  - - "~>"
78
74
  - !ruby/object:Gem::Version
79
- version: '3.1'
80
- type: :runtime
75
+ version: '5.2'
76
+ type: :development
81
77
  prerelease: false
82
78
  version_requirements: !ruby/object:Gem::Requirement
83
79
  requirements:
84
80
  - - "~>"
85
81
  - !ruby/object:Gem::Version
86
- version: '3.1'
82
+ version: '5.2'
87
83
  - !ruby/object:Gem::Dependency
88
84
  name: bundler
89
85
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +94,62 @@ dependencies:
98
94
  - - "~>"
99
95
  - !ruby/object:Gem::Version
100
96
  version: '2.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fakefs
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.18'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.18'
111
+ - !ruby/object:Gem::Dependency
112
+ name: gem-release
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.1'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '2.1'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '2.16'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.16'
139
+ - !ruby/object:Gem::Dependency
140
+ name: guard-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '4.7'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '4.7'
101
153
  - !ruby/object:Gem::Dependency
102
154
  name: rake
103
155
  requirement: !ruby/object:Gem::Requirement
@@ -141,33 +193,33 @@ dependencies:
141
193
  - !ruby/object:Gem::Version
142
194
  version: '0.5'
143
195
  - !ruby/object:Gem::Dependency
144
- name: rake_ssh
196
+ name: rake_gpg
145
197
  requirement: !ruby/object:Gem::Requirement
146
198
  requirements:
147
199
  - - "~>"
148
200
  - !ruby/object:Gem::Version
149
- version: '0.4'
201
+ version: '0.12'
150
202
  type: :development
151
203
  prerelease: false
152
204
  version_requirements: !ruby/object:Gem::Requirement
153
205
  requirements:
154
206
  - - "~>"
155
207
  - !ruby/object:Gem::Version
156
- version: '0.4'
208
+ version: '0.12'
157
209
  - !ruby/object:Gem::Dependency
158
- name: rake_gpg
210
+ name: rake_ssh
159
211
  requirement: !ruby/object:Gem::Requirement
160
212
  requirements:
161
213
  - - "~>"
162
214
  - !ruby/object:Gem::Version
163
- version: '0.12'
215
+ version: '0.4'
164
216
  type: :development
165
217
  prerelease: false
166
218
  version_requirements: !ruby/object:Gem::Requirement
167
219
  requirements:
168
220
  - - "~>"
169
221
  - !ruby/object:Gem::Version
170
- version: '0.12'
222
+ version: '0.4'
171
223
  - !ruby/object:Gem::Dependency
172
224
  name: rspec
173
225
  requirement: !ruby/object:Gem::Requirement
@@ -183,47 +235,75 @@ dependencies:
183
235
  - !ruby/object:Gem::Version
184
236
  version: '3.9'
185
237
  - !ruby/object:Gem::Dependency
186
- name: gem-release
238
+ name: rubocop
187
239
  requirement: !ruby/object:Gem::Requirement
188
240
  requirements:
189
241
  - - "~>"
190
242
  - !ruby/object:Gem::Version
191
- version: '2.0'
243
+ version: '1.12'
192
244
  type: :development
193
245
  prerelease: false
194
246
  version_requirements: !ruby/object:Gem::Requirement
195
247
  requirements:
196
248
  - - "~>"
197
249
  - !ruby/object:Gem::Version
198
- version: '2.0'
250
+ version: '1.12'
199
251
  - !ruby/object:Gem::Dependency
200
- name: activesupport
252
+ name: rubocop-rake
201
253
  requirement: !ruby/object:Gem::Requirement
202
254
  requirements:
203
255
  - - "~>"
204
256
  - !ruby/object:Gem::Version
205
- version: '5.2'
257
+ version: '0.5'
206
258
  type: :development
207
259
  prerelease: false
208
260
  version_requirements: !ruby/object:Gem::Requirement
209
261
  requirements:
210
262
  - - "~>"
211
263
  - !ruby/object:Gem::Version
212
- version: '5.2'
264
+ version: '0.5'
213
265
  - !ruby/object:Gem::Dependency
214
- name: fakefs
266
+ name: rubocop-rspec
215
267
  requirement: !ruby/object:Gem::Requirement
216
268
  requirements:
217
269
  - - "~>"
218
270
  - !ruby/object:Gem::Version
219
- version: '0.18'
271
+ version: '2.2'
220
272
  type: :development
221
273
  prerelease: false
222
274
  version_requirements: !ruby/object:Gem::Requirement
223
275
  requirements:
224
276
  - - "~>"
225
277
  - !ruby/object:Gem::Version
226
- version: '0.18'
278
+ version: '2.2'
279
+ - !ruby/object:Gem::Dependency
280
+ name: simplecov
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - "~>"
284
+ - !ruby/object:Gem::Version
285
+ version: '0.21'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - "~>"
291
+ - !ruby/object:Gem::Version
292
+ version: '0.21'
293
+ - !ruby/object:Gem::Dependency
294
+ name: yard
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '0.9'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '0.9'
227
307
  description: Provides rake tasks for executing terraform commands as part of a rake
228
308
  build.
229
309
  email:
@@ -243,6 +323,8 @@ files:
243
323
  - lib/rake_terraform.rb
244
324
  - lib/rake_terraform/task_sets.rb
245
325
  - lib/rake_terraform/task_sets/all.rb
326
+ - lib/rake_terraform/task_sets/provider.rb
327
+ - lib/rake_terraform/task_sets/terraform.rb
246
328
  - lib/rake_terraform/tasks.rb
247
329
  - lib/rake_terraform/tasks/destroy.rb
248
330
  - lib/rake_terraform/tasks/output.rb
@@ -250,6 +332,7 @@ files:
250
332
  - lib/rake_terraform/tasks/provision.rb
251
333
  - lib/rake_terraform/tasks/validate.rb
252
334
  - lib/rake_terraform/version.rb
335
+ - rake_terraform.gemspec
253
336
  homepage: https://github.com/infrablocks/rake_terraform
254
337
  licenses:
255
338
  - MIT