rake-terraform-wrapper 0.1.0 → 0.2.0

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: 89c88b4d3fb51f2b11cac6e38f3750935ff678eedf6f8be9a4d57a50c0d7c18c
4
- data.tar.gz: 16f80114887a769b5473439f61009df0da52cc9683339ba97c9f9ddd195a3080
3
+ metadata.gz: 448485af1114d09c0f4d806a02b3177948369b5679025910c1b076f32a5a61d3
4
+ data.tar.gz: 597dee0e4ba879dcda9009f0283d3c40967c1c6b1218628356e5b4eaef4f0c61
5
5
  SHA512:
6
- metadata.gz: 477ad93228587c2a6522725056f46ff8e76399069a2deb61516d3b27410d94e2c44f93aa92a66f2bffd15bd13b2fa6ec84f141663b27a833b00bc799f12bd418
7
- data.tar.gz: c03895337c9fbad834e96ab9c604505549e85744f0240b309b875ee402c135d2a8abff578799cb4c0ff4e7370d4e1019a3778439e8f21d00cc29c9a05c36c39a
6
+ metadata.gz: 229c539407b0db01bca15399157fb1741776344e365d8a170aa22c7e6d6020e3dfcb797e615db5ecda678ab922d93244a3f7cf915e2345b8ea0b9f8881eb7ea3
7
+ data.tar.gz: a3736d29dfe27eb8ff41ed91e45e365e6b07d5f37e5df732ed10b6d939948a8c064e494e3817404b1184946d560ff1f02fbafd313ace3351dbc604e8c9ff222a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake-terraform-wrapper (0.1.0)
4
+ rake-terraform-wrapper (0.2.0)
5
5
  mixlib-shellout (~> 3.1)
6
6
  os (~> 1.1)
7
7
  rake (~> 13.0)
data/README.md CHANGED
@@ -27,6 +27,7 @@ namespace :network do
27
27
  Ruby::Terraform::Tasks::AllTasks.new(:network) do |tf|
28
28
  tf.dir = File.absolute_path("infra/network")
29
29
  tf.backend = 's3'
30
+ tf.build_dir = 'tmp' # optional. This will copy everything in the `tf.dir` into `build_dir` and execute terraform from this directory
30
31
  tf.backend_config = {
31
32
  bucket: 'some-bucket',
32
33
  key: 'network.tfstate',
@@ -18,7 +18,9 @@ module Ruby
18
18
  formatter = proc do |severity, datetime, progname, msg|
19
19
  "#{msg}\n"
20
20
  end
21
- shellout_opts[:logger] = Logger.new(STDERR, formatter: formatter)
21
+ logger = Logger.new(STDERR, formatter: formatter)
22
+ shellout_opts[:logger] = logger
23
+ loger.info("Running command inside directory: #{shellout_opts[:cwd]}") if shellout_opts[:cwd]
22
24
  end
23
25
 
24
26
  cmd = Mixlib::ShellOut.new(command, shellout_opts)
@@ -12,9 +12,20 @@ module Ruby
12
12
 
13
13
  attr_accessor :json
14
14
 
15
+ attr_accessor :build_dir
16
+
15
17
  def define
16
- InitTask.new(configuration_name, :init) do |task|
17
- task.dir = dir
18
+ dir_to_use = File.expand_path(build_dir ? "#{build_dir}/#{dir}" : dir)
19
+
20
+ if build_dir
21
+ task :pre_init do
22
+ rm_rf dir_to_use
23
+ cp_r dir, dir_to_use
24
+ end
25
+ end
26
+
27
+ InitTask.new(configuration_name, :init => build_dir ? [:pre_init] : []) do |task|
28
+ task.dir = dir_to_use
18
29
  task.backend = backend
19
30
  task.backend_config = backend_config
20
31
  task.show_output = show_output
@@ -22,7 +33,7 @@ module Ruby
22
33
  end
23
34
 
24
35
  ApplyTask.new(configuration_name, :apply => :init) do |task|
25
- task.dir = dir
36
+ task.dir = dir_to_use
26
37
  task.state = state
27
38
  task.vars = vars
28
39
  task.auto_approve = auto_approve
@@ -31,7 +42,7 @@ module Ruby
31
42
  end
32
43
 
33
44
  DestroyTask.new(configuration_name, :destroy => :init) do |task|
34
- task.dir = dir
45
+ task.dir = dir_to_use
35
46
  task.state = state
36
47
  task.vars = vars
37
48
  task.auto_approve = auto_approve
@@ -40,7 +51,7 @@ module Ruby
40
51
  end
41
52
 
42
53
  OutputTask.new(configuration_name, :output => :init) do |task|
43
- task.dir = dir
54
+ task.dir = dir_to_use
44
55
  task.state = state
45
56
  task.json = json
46
57
  task.show_output = show_output
@@ -48,7 +59,7 @@ module Ruby
48
59
  end
49
60
 
50
61
  PlanTask.new(configuration_name, :plan => :init) do |task|
51
- task.dir = dir
62
+ task.dir = dir_to_use
52
63
  task.state = state
53
64
  task.vars = vars
54
65
  task.show_output = show_output
@@ -56,7 +67,7 @@ module Ruby
56
67
  end
57
68
 
58
69
  ValidateTask.new(configuration_name, :validate => :init) do |task|
59
- task.dir = dir
70
+ task.dir = dir_to_use
60
71
  task.json = json
61
72
  task.show_output = show_output
62
73
  task.show_command = show_command
@@ -1,6 +1,6 @@
1
1
  module Ruby
2
2
  module Terraform
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  TERRAFORM_VERSION = '0.13.3'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-terraform-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruby Terraform