terragov 0.3.1.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: 82794ef0eedbf8bd334a1503115a8cac1fc65db2
4
- data.tar.gz: fe6c085b201cb8f97e43422349c6e8c9207a5538
3
+ metadata.gz: 18df1434ae9c550495cb0bc00a2da7577bf50295
4
+ data.tar.gz: 4ef166343fae271dec31b8aeaf0585de57750fb2
5
5
  SHA512:
6
- metadata.gz: cd42773c34aa60e6fcd07c4fb30c63a7bd47da27f53c71c1d3fc42fb2208a2b954b110c11ce6a0ceea73efd5154a7debe4d074285ee9dc4e45e2d85db79905e4
7
- data.tar.gz: 87beca2ca7b948cb54274472d052deefd6efc78a1ed266fec30fd58a9426c46131ffa5777f95d38facbddbe0e31f566101bfd089f40ca9343da7d317ce16d4f2
6
+ metadata.gz: 36c0214bd7731eb39564e024c0ec19fc962a3482a651477caa8079f86a0e16b7852f110fb461b6627054565885b722d1508894dba38af7fe9dead119d96efde7
7
+ data.tar.gz: 61614afcf67f13d5f7e391e09854079323f1e4b19e636092572a2934e3ad1dbcfddbdceee157883cc654e076e6d9fd165be718ebfa5f0493f309d03e2c44b762
@@ -1,3 +1,8 @@
1
+ ## 0.3.2 (2017-12-29)
2
+
3
+ - Allow force when applying on Terraform versions >=0.11
4
+ - Allow force apply and destroy on deployments on Terraform versions >=0.11
5
+
1
6
  ## 0.3.1 (2017-12-28)
2
7
 
3
8
  - Added a "deploy" command to allow deploying multiple projects in order as defined
@@ -237,7 +237,7 @@ module Terragov
237
237
  Terragov::Terraform.new.execute(cmd, varfiles, backend, project_dir, do_dryrun, be_verbose)
238
238
  end
239
239
 
240
- def run_deployment(file, group, command)
240
+ def run_deployment(file, group, command, force)
241
241
  abort("Must set deployment file: --file") unless file
242
242
  abort("Must set command to run: --command") unless command
243
243
  abort("Cannot find deployment file: #{file}") unless File.exist?(file)
@@ -250,11 +250,19 @@ module Terragov
250
250
  end
251
251
 
252
252
  if command == 'plan' || command == 'apply'
253
+ if force && command == 'apply'
254
+ command = "#{command} -auto-approve"
255
+ end
256
+
253
257
  deployment_config.each do |proj|
254
258
  $project = proj
255
259
  run_terraform_cmd(command, nil, true)
256
260
  end
257
261
  elsif command == 'destroy'
262
+ if force
263
+ command = "#{command} -force"
264
+ end
265
+
258
266
  deployment_config.reverse.each do |proj|
259
267
  $project = proj
260
268
  run_terraform_cmd(command, nil, true)
@@ -268,7 +276,7 @@ module Terragov
268
276
  command :plan do |c|
269
277
  c.syntax = 'terragov plan'
270
278
  c.description = 'Runs a plan of your code'
271
- c.action do |_args, _options|
279
+ c.action do |_args, options|
272
280
  run_terraform_cmd(c.name)
273
281
  end
274
282
  end
@@ -276,8 +284,13 @@ module Terragov
276
284
  command :apply do |c|
277
285
  c.syntax = 'terragov apply'
278
286
  c.description = 'Apply your code'
279
- c.action do |_args, _options|
280
- run_terraform_cmd(c.name)
287
+ c.option '--force', 'Force apply'
288
+ c.action do |_args, options|
289
+ if options.force
290
+ run_terraform_cmd("#{c.name} -auto-approve")
291
+ else
292
+ run_terraform_cmd(c.name)
293
+ end
281
294
  end
282
295
  end
283
296
 
@@ -300,11 +313,12 @@ module Terragov
300
313
  c.option '-f', '--file STRING', 'Specify deployment file'
301
314
  c.option '-g', '--group STRING', 'Specify group that you wish to deploy'
302
315
  c.option '-c', '--command STRING', 'What command to run: apply, plan or destroy.'
316
+ c.option '--force', 'Force apply or destroy'
303
317
  c.action do |_args, options|
304
318
 
305
319
  group = options.group.nil? ? 'default' : options.group
306
320
 
307
- run_deployment(options.file, group, options.command)
321
+ run_deployment(options.file, group, options.command, options.force)
308
322
  end
309
323
  end
310
324
 
@@ -1,3 +1,3 @@
1
1
  module Terragov
2
- VERSION = '0.3.1.1'.freeze
2
+ VERSION = '0.3.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terragov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laura Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-28 00:00:00.000000000 Z
11
+ date: 2017-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  requirements: []
203
203
  rubyforge_project:
204
- rubygems_version: 2.6.8
204
+ rubygems_version: 2.6.11
205
205
  signing_key:
206
206
  specification_version: 4
207
207
  summary: Wrapper for GOV.UK Terraform deployments.