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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/ruby/terraform/execution_support.rb +3 -1
- data/lib/ruby/terraform/tasks/all_tasks.rb +18 -7
- data/lib/ruby/terraform/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 448485af1114d09c0f4d806a02b3177948369b5679025910c1b076f32a5a61d3
|
4
|
+
data.tar.gz: 597dee0e4ba879dcda9009f0283d3c40967c1c6b1218628356e5b4eaef4f0c61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 229c539407b0db01bca15399157fb1741776344e365d8a170aa22c7e6d6020e3dfcb797e615db5ecda678ab922d93244a3f7cf915e2345b8ea0b9f8881eb7ea3
|
7
|
+
data.tar.gz: a3736d29dfe27eb8ff41ed91e45e365e6b07d5f37e5df732ed10b6d939948a8c064e494e3817404b1184946d560ff1f02fbafd313ace3351dbc604e8c9ff222a
|
data/Gemfile.lock
CHANGED
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
|
-
|
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
|
-
|
17
|
-
|
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 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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
|