rake_terraform 0.21.1.pre2 → 0.21.1.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rake_terraform/version.rb +1 -1
- data/lib/rake_terraform.rb +45 -0
- 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: 0eafbb9445ade96e1cf734437df91532c7099a59e8d783d7f858476f983c1626
|
4
|
+
data.tar.gz: 3dc39ef6a075ebe0adeaf2b0a5e235616f3589db97be929884049b4e8373605b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 608b122ba644ad677c411913190063658c709e1b5d816773baf38a440b0ce5dda7d4df3c616b0d1d753aaa0a1cb34369548e81db6e70cc26f1f6b03de9608315
|
7
|
+
data.tar.gz: c35c3e1c5ed07132ced8140708bcdd72867fc80c92d2b02c7c0c38ae85b9953e36db5bdbf23a22f9fa2e4bd60a03bbab23158f82d1bc2897e89d61f06474b062
|
data/Gemfile.lock
CHANGED
data/lib/rake_terraform.rb
CHANGED
@@ -15,6 +15,7 @@ module RakeTerraform
|
|
15
15
|
namespace = opts[:namespace] || :terraform
|
16
16
|
version = opts[:version] || '0.10.3'
|
17
17
|
path = opts[:path] || File.join('vendor', 'terraform')
|
18
|
+
providers = opts[:providers] || []
|
18
19
|
|
19
20
|
RubyTerraform.configure do |c|
|
20
21
|
c.binary = File.join(path, 'bin', 'terraform')
|
@@ -55,5 +56,49 @@ module RakeTerraform
|
|
55
56
|
return true
|
56
57
|
end
|
57
58
|
end
|
59
|
+
providers.each do |provider|
|
60
|
+
name = provider[:name]
|
61
|
+
version = provider[:version]
|
62
|
+
path = provider[:path]
|
63
|
+
repository = provider[:repository]
|
64
|
+
dependency = "terraform-provider-#{name}"
|
65
|
+
|
66
|
+
Rake.application.in_namespace namespace do
|
67
|
+
Rake.application.in_namespace :providers do
|
68
|
+
RakeDependencies::Tasks::All.new do |t|
|
69
|
+
t.namespace = name
|
70
|
+
t.dependency = dependency
|
71
|
+
t.version = version
|
72
|
+
t.path = path
|
73
|
+
t.type = :tar_gz
|
74
|
+
|
75
|
+
t.os_ids = {mac: 'darwin', linux: 'linux'}
|
76
|
+
|
77
|
+
t.uri_template =
|
78
|
+
"https://github.com/#{repository}/releases/download/" +
|
79
|
+
"<%= @version %>/#{dependency}_v<%= @version %>_" +
|
80
|
+
"<%= @os_id %>_amd64<%= @ext %>"
|
81
|
+
t.file_name_template =
|
82
|
+
"#{dependency}_v<%= @version %>_<%= @os_id %>_amd64<%= @ext %>"
|
83
|
+
|
84
|
+
t.source_binary_name_template = dependency
|
85
|
+
t.target_binary_name_template = "#{dependency}_v<%= @version %>"
|
86
|
+
|
87
|
+
t.installation_directory = "#{ENV['HOME']}/.terraform.d/plugins"
|
88
|
+
|
89
|
+
t.needs_fetch = lambda do |parameters|
|
90
|
+
!File.exists?(
|
91
|
+
File.join(
|
92
|
+
parameters[:path],
|
93
|
+
parameters[:binary_directory],
|
94
|
+
"#{dependency}_v#{parameters[:version]}"))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
Rake::Task["#{namespace}:ensure"]
|
101
|
+
.enhance(providers.map {|provider|
|
102
|
+
"#{namespace}:providers:#{provider[:name]}:ensure"})
|
58
103
|
end
|
59
104
|
end
|