rake-terraform-wrapper 0.2.3 → 0.3.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 +2 -2
- data/README.md +18 -0
- data/lib/ruby/terraform/configuration.rb +12 -0
- data/lib/ruby/terraform/executable.rb +4 -6
- data/lib/ruby/terraform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7397085e32a0cf518d65d3e6dfbe28a4ffde5cbacecac79bea4ae24b586f740c
|
4
|
+
data.tar.gz: 90474808154b39372a61dd0b691617987ca6a4ee3a3201ad2909e97d45533307
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44512e7239fbc0743d18378c6308bee6edb43fbf75d203383af1092dffbae5c393506ceacf324d5a12415eeae66b1b78d3515d858d1b6a82c9d0466210a08f81
|
7
|
+
data.tar.gz: 73463bcd33110d0a2750a1c2c588119cb93704793d57c08e0c2bc3079634b048e6f339677ed7750ca656b3976ef002e94b1bbf0394c47e0314dbccc71d9b9c6a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rake-terraform-wrapper (0.
|
4
|
+
rake-terraform-wrapper (0.3.0)
|
5
5
|
mixlib-shellout (~> 3.1)
|
6
6
|
os (~> 1.1)
|
7
7
|
rake (~> 13.0)
|
@@ -10,7 +10,7 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
chef-utils (16.
|
13
|
+
chef-utils (16.6.14)
|
14
14
|
coderay (1.1.3)
|
15
15
|
diff-lcs (1.4.4)
|
16
16
|
ffi (1.13.1)
|
data/README.md
CHANGED
@@ -23,6 +23,24 @@ Or install it yourself as:
|
|
23
23
|
```ruby
|
24
24
|
require 'rake-terraform-wrapper'
|
25
25
|
|
26
|
+
# specify the following optional config
|
27
|
+
Ruby::Terraform.config do |c|
|
28
|
+
c.binary = "/path/to/terraform" # or `terraform.exe` on windows
|
29
|
+
|
30
|
+
# if you prefer that the binary is downloaded automatically, specify the version of the terraform binary
|
31
|
+
c.terraform_version = '13.0' #Default version
|
32
|
+
|
33
|
+
# optionally, specifiy the location where you want the terraform zip file to be downloaded
|
34
|
+
c.download_path = "~/.terraform-bin/#{terraform_version}" #default path
|
35
|
+
end
|
36
|
+
|
37
|
+
# to force download, if not specified, terraform will be downloaded automatically on first usage
|
38
|
+
task :download_terraform do
|
39
|
+
executable = Ruby::Terraform::Executable.new
|
40
|
+
executable.download({verbose: true})
|
41
|
+
executable.extract
|
42
|
+
end
|
43
|
+
|
26
44
|
namespace :network do
|
27
45
|
Ruby::Terraform::Tasks::AllTasks.new(:network) do |tf|
|
28
46
|
tf.dir = File.absolute_path("infra/network")
|
@@ -3,10 +3,22 @@ module Ruby
|
|
3
3
|
class Configuration
|
4
4
|
attr_accessor :terraform_version
|
5
5
|
attr_accessor :download_path
|
6
|
+
attr_accessor :binary
|
6
7
|
|
7
8
|
def initialize(opts = {})
|
8
9
|
@terraform_version = opts[:terraform_version] || Ruby::Terraform::TERRAFORM_VERSION
|
9
10
|
@download_path = opts[:download_path] || File.expand_path("~/.terraform-bin/#{terraform_version}")
|
11
|
+
@binary = opts[:terraform_binary]
|
12
|
+
end
|
13
|
+
|
14
|
+
def binary
|
15
|
+
if @binary
|
16
|
+
@binary
|
17
|
+
elsif OS.windows?
|
18
|
+
"#{@download_path}/terraform.exe"
|
19
|
+
else
|
20
|
+
"#{@download_path}/terraform"
|
21
|
+
end
|
10
22
|
end
|
11
23
|
end
|
12
24
|
end
|
@@ -7,6 +7,8 @@ module Ruby
|
|
7
7
|
|
8
8
|
def config
|
9
9
|
@config ||= Configuration.new
|
10
|
+
yield @config if block_given?
|
11
|
+
@config
|
10
12
|
end
|
11
13
|
|
12
14
|
class Executable
|
@@ -15,19 +17,15 @@ module Ruby
|
|
15
17
|
def initialize(config = Ruby::Terraform.config)
|
16
18
|
@terraform_version = config.terraform_version
|
17
19
|
@download_path = config.download_path
|
20
|
+
@binary = config.binary
|
18
21
|
@download_filename = "#{@terraform_version}-terraform.zip"
|
19
|
-
|
20
22
|
FileUtils.mkdir_p(@download_path)
|
21
23
|
|
22
24
|
raise PlatformUnsupported unless supported?
|
23
25
|
end
|
24
26
|
|
25
27
|
def binary
|
26
|
-
|
27
|
-
"#{@download_path}/terraform.exe"
|
28
|
-
else
|
29
|
-
"#{@download_path}/terraform"
|
30
|
-
end
|
28
|
+
@binary
|
31
29
|
end
|
32
30
|
|
33
31
|
def download(opts = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-terraform-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruby Terraform
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|