rake_terraform 1.14.0.pre.1 → 1.16.0.pre.4
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 +2 -0
- data/Gemfile.lock +94 -14
- data/Rakefile +89 -42
- data/bin/console +4 -3
- data/lib/rake_terraform.rb +33 -114
- data/lib/rake_terraform/task_sets.rb +4 -0
- data/lib/rake_terraform/task_sets/all.rb +50 -40
- data/lib/rake_terraform/task_sets/provider.rb +168 -0
- data/lib/rake_terraform/task_sets/terraform.rb +179 -0
- data/lib/rake_terraform/tasks.rb +2 -0
- data/lib/rake_terraform/tasks/destroy.rb +42 -30
- data/lib/rake_terraform/tasks/output.rb +34 -28
- data/lib/rake_terraform/tasks/plan.rb +40 -32
- data/lib/rake_terraform/tasks/provision.rb +42 -31
- data/lib/rake_terraform/tasks/validate.rb +33 -33
- data/lib/rake_terraform/version.rb +3 -1
- data/rake_terraform.gemspec +62 -0
- metadata +130 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 965b40b0c36d99a305fb3f25e1904c6c9b36e94a86fe082c16ae699cc0890e04
|
4
|
+
data.tar.gz: 328eebca57dce17aed6ebe9c2ce75421370c064e0e008db8a3e821efd3eb28d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdfa8da2e8a2111a4147217958adf87cf9c137c79714f72b0941e11474c1082c985ec1c4e2793261a6cbca62ce452c1ec81cfd5f52630c34d7e2d4187e91f323
|
7
|
+
data.tar.gz: 707f27a977da8243fec069799a1294a86bf9ab72790c917ad35d9e2040ce5583dfcd8c26bbf08941182b71c067ee505699259580607edc791aa0f6e7a73a378d
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,48 +1,88 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rake_terraform (1.
|
4
|
+
rake_terraform (1.16.0.pre.4)
|
5
5
|
colored2 (~> 3.1)
|
6
|
-
rake_dependencies (~> 2
|
7
|
-
rake_factory (
|
8
|
-
ruby-terraform (
|
6
|
+
rake_dependencies (~> 2.9)
|
7
|
+
rake_factory (~> 0.23)
|
8
|
+
ruby-terraform (~> 1.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (5.2.
|
13
|
+
activesupport (5.2.6)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 0.7, < 2)
|
16
16
|
minitest (~> 5.1)
|
17
17
|
tzinfo (~> 1.1)
|
18
18
|
addressable (2.7.0)
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
+
ast (2.4.2)
|
21
|
+
coderay (1.1.3)
|
20
22
|
colored2 (3.1.2)
|
21
23
|
concurrent-ruby (1.1.8)
|
22
24
|
diff-lcs (1.4.4)
|
23
|
-
|
25
|
+
docile (1.3.5)
|
26
|
+
excon (0.81.0)
|
24
27
|
fakefs (0.20.1)
|
25
|
-
faraday (1.
|
28
|
+
faraday (1.4.1)
|
29
|
+
faraday-excon (~> 1.1)
|
26
30
|
faraday-net_http (~> 1.0)
|
31
|
+
faraday-net_http_persistent (~> 1.1)
|
27
32
|
multipart-post (>= 1.2, < 3)
|
28
|
-
ruby2_keywords
|
33
|
+
ruby2_keywords (>= 0.0.4)
|
34
|
+
faraday-excon (1.1.0)
|
29
35
|
faraday-net_http (1.0.1)
|
36
|
+
faraday-net_http_persistent (1.1.0)
|
37
|
+
ffi (1.15.0)
|
38
|
+
formatador (0.2.5)
|
30
39
|
gem-release (2.2.1)
|
40
|
+
guard (2.16.2)
|
41
|
+
formatador (>= 0.2.4)
|
42
|
+
listen (>= 2.7, < 4.0)
|
43
|
+
lumberjack (>= 1.0.12, < 2.0)
|
44
|
+
nenv (~> 0.1)
|
45
|
+
notiffany (~> 0.0)
|
46
|
+
pry (>= 0.9.12)
|
47
|
+
shellany (~> 0.0)
|
48
|
+
thor (>= 0.18.1)
|
49
|
+
guard-compat (1.2.1)
|
50
|
+
guard-rspec (4.7.3)
|
51
|
+
guard (~> 2.1)
|
52
|
+
guard-compat (~> 1.1)
|
53
|
+
rspec (>= 2.99.0, < 4.0)
|
31
54
|
hamster (3.0.0)
|
32
55
|
concurrent-ruby (~> 1.0)
|
33
56
|
i18n (1.8.10)
|
34
57
|
concurrent-ruby (~> 1.0)
|
35
|
-
|
58
|
+
immutable-struct (2.4.1)
|
59
|
+
lino (3.0.0)
|
36
60
|
hamster (~> 3.0)
|
37
61
|
open4 (~> 1.3)
|
62
|
+
listen (3.5.1)
|
63
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
64
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
65
|
+
lumberjack (1.2.8)
|
66
|
+
method_source (1.0.0)
|
38
67
|
minitar (0.9)
|
39
68
|
minitest (5.14.4)
|
40
69
|
multipart-post (2.1.1)
|
41
|
-
|
70
|
+
nenv (0.3.0)
|
71
|
+
notiffany (0.1.3)
|
72
|
+
nenv (~> 0.1)
|
73
|
+
shellany (~> 0.0)
|
74
|
+
octokit (4.21.0)
|
42
75
|
faraday (>= 0.9)
|
43
76
|
sawyer (~> 0.8.0, >= 0.5.3)
|
44
77
|
open4 (1.3.4)
|
78
|
+
parallel (1.20.1)
|
79
|
+
parser (3.0.1.1)
|
80
|
+
ast (~> 2.4.1)
|
81
|
+
pry (0.14.1)
|
82
|
+
coderay (~> 1.1)
|
83
|
+
method_source (~> 1.0)
|
45
84
|
public_suffix (4.0.6)
|
85
|
+
rainbow (3.0.0)
|
46
86
|
rake (13.0.3)
|
47
87
|
rake_circle_ci (0.9.0)
|
48
88
|
colored2 (~> 3.1)
|
@@ -69,6 +109,11 @@ GEM
|
|
69
109
|
colored2 (~> 3.1)
|
70
110
|
rake_factory (~> 0.23)
|
71
111
|
sshkey (~> 2.0)
|
112
|
+
rb-fsevent (0.11.0)
|
113
|
+
rb-inotify (0.10.1)
|
114
|
+
ffi (~> 1.0)
|
115
|
+
regexp_parser (2.1.1)
|
116
|
+
rexml (3.2.5)
|
72
117
|
rspec (3.10.0)
|
73
118
|
rspec-core (~> 3.10.0)
|
74
119
|
rspec-expectations (~> 3.10.0)
|
@@ -82,8 +127,26 @@ GEM
|
|
82
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
128
|
rspec-support (~> 3.10.0)
|
84
129
|
rspec-support (3.10.2)
|
85
|
-
|
86
|
-
|
130
|
+
rubocop (1.14.0)
|
131
|
+
parallel (~> 1.10)
|
132
|
+
parser (>= 3.0.0.0)
|
133
|
+
rainbow (>= 2.2.2, < 4.0)
|
134
|
+
regexp_parser (>= 1.8, < 3.0)
|
135
|
+
rexml
|
136
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
137
|
+
ruby-progressbar (~> 1.7)
|
138
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
139
|
+
rubocop-ast (1.5.0)
|
140
|
+
parser (>= 3.0.1.1)
|
141
|
+
rubocop-rake (0.5.1)
|
142
|
+
rubocop
|
143
|
+
rubocop-rspec (2.3.0)
|
144
|
+
rubocop (~> 1.0)
|
145
|
+
rubocop-ast (>= 1.1.0)
|
146
|
+
ruby-progressbar (1.11.0)
|
147
|
+
ruby-terraform (1.2.0)
|
148
|
+
immutable-struct (~> 2.4)
|
149
|
+
lino (~> 3.0)
|
87
150
|
ruby2_keywords (0.0.4)
|
88
151
|
ruby_gpg2 (0.8.0)
|
89
152
|
lino (>= 1.5)
|
@@ -91,10 +154,20 @@ GEM
|
|
91
154
|
sawyer (0.8.2)
|
92
155
|
addressable (>= 2.3.5)
|
93
156
|
faraday (> 0.8, < 2.0)
|
157
|
+
shellany (0.0.1)
|
158
|
+
simplecov (0.21.2)
|
159
|
+
docile (~> 1.1)
|
160
|
+
simplecov-html (~> 0.11)
|
161
|
+
simplecov_json_formatter (~> 0.1)
|
162
|
+
simplecov-html (0.12.3)
|
163
|
+
simplecov_json_formatter (0.1.3)
|
94
164
|
sshkey (2.0.0)
|
165
|
+
thor (1.1.0)
|
95
166
|
thread_safe (0.3.6)
|
96
167
|
tzinfo (1.2.9)
|
97
168
|
thread_safe (~> 0.1)
|
169
|
+
unicode-display_width (2.0.0)
|
170
|
+
yard (0.9.26)
|
98
171
|
|
99
172
|
PLATFORMS
|
100
173
|
ruby
|
@@ -103,7 +176,9 @@ DEPENDENCIES
|
|
103
176
|
activesupport (~> 5.2)
|
104
177
|
bundler (~> 2.0)
|
105
178
|
fakefs (~> 0.18)
|
106
|
-
gem-release (~> 2.
|
179
|
+
gem-release (~> 2.1)
|
180
|
+
guard (~> 2.16)
|
181
|
+
guard-rspec (~> 4.7)
|
107
182
|
rake (~> 13.0)
|
108
183
|
rake_circle_ci (~> 0.9)
|
109
184
|
rake_github (~> 0.5)
|
@@ -111,6 +186,11 @@ DEPENDENCIES
|
|
111
186
|
rake_ssh (~> 0.4)
|
112
187
|
rake_terraform!
|
113
188
|
rspec (~> 3.9)
|
189
|
+
rubocop (~> 1.12)
|
190
|
+
rubocop-rake (~> 0.5)
|
191
|
+
rubocop-rspec (~> 2.2)
|
192
|
+
simplecov (~> 0.21)
|
193
|
+
yard (~> 0.9)
|
114
194
|
|
115
195
|
BUNDLED WITH
|
116
|
-
2.2.
|
196
|
+
2.2.17
|
data/Rakefile
CHANGED
@@ -1,17 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
4
|
+
require 'yard'
|
2
5
|
require 'rake_circle_ci'
|
3
6
|
require 'rake_github'
|
4
7
|
require 'rake_ssh'
|
5
8
|
require 'rake_gpg'
|
6
9
|
require 'securerandom'
|
7
10
|
require 'rspec/core/rake_task'
|
11
|
+
require 'rubocop/rake_task'
|
8
12
|
|
9
|
-
task :
|
10
|
-
|
11
|
-
|
13
|
+
task default: %i[
|
14
|
+
library:fix
|
15
|
+
test:unit
|
16
|
+
]
|
12
17
|
|
13
18
|
namespace :encryption do
|
14
19
|
namespace :passphrase do
|
20
|
+
desc 'Generate encryption passphrase for CI GPG key'
|
15
21
|
task :generate do
|
16
22
|
File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
|
17
23
|
f.write(SecureRandom.base64(36))
|
@@ -23,83 +29,124 @@ end
|
|
23
29
|
namespace :keys do
|
24
30
|
namespace :deploy do
|
25
31
|
RakeSSH.define_key_tasks(
|
26
|
-
|
27
|
-
|
32
|
+
path: 'config/secrets/ci/',
|
33
|
+
comment: 'maintainers@infrablocks.io'
|
34
|
+
)
|
28
35
|
end
|
29
36
|
|
30
37
|
namespace :gpg do
|
31
38
|
RakeGPG.define_generate_key_task(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
39
|
+
output_directory: 'config/secrets/ci',
|
40
|
+
name_prefix: 'gpg',
|
41
|
+
owner_name: 'InfraBlocks Maintainers',
|
42
|
+
owner_email: 'maintainers@infrablocks.io',
|
43
|
+
owner_comment: 'rake_terraform CI Key'
|
44
|
+
)
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
48
|
+
RuboCop::RakeTask.new
|
49
|
+
|
50
|
+
YARD::Rake::YardocTask.new do |t|
|
51
|
+
t.files = ['lib/**/*.rb']
|
52
|
+
t.options = %w[--embed-mixins --output-dir docs]
|
53
|
+
end
|
54
|
+
|
55
|
+
namespace :library do
|
56
|
+
desc 'Run all checks of the library'
|
57
|
+
task check: [:rubocop]
|
58
|
+
|
59
|
+
desc 'Attempt to automatically fix issues with the library'
|
60
|
+
task fix: [:'rubocop:auto_correct']
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :documentation do
|
64
|
+
desc 'Generate documentation'
|
65
|
+
task generate: [:yard]
|
66
|
+
|
67
|
+
desc 'Commit documentation'
|
68
|
+
task :commit, [:skip] do |_, args|
|
69
|
+
args.with_defaults(skip: 'true')
|
70
|
+
|
71
|
+
skip_ci = args.skip == 'true'
|
72
|
+
|
73
|
+
sh('git', 'commit',
|
74
|
+
'-a',
|
75
|
+
'-m', "Generate latest documentation#{skip_ci ? ' [ci skip]' : ''}")
|
76
|
+
end
|
77
|
+
|
78
|
+
desc 'Update documentation'
|
79
|
+
task update: %i[generate commit]
|
80
|
+
end
|
81
|
+
|
82
|
+
namespace :test do
|
83
|
+
RSpec::Core::RakeTask.new(:unit)
|
84
|
+
end
|
85
|
+
|
40
86
|
RakeCircleCI.define_project_tasks(
|
41
|
-
|
42
|
-
|
87
|
+
namespace: :circle_ci,
|
88
|
+
project_slug: 'github/infrablocks/rake_terraform'
|
43
89
|
) do |t|
|
44
90
|
circle_ci_config =
|
45
|
-
|
91
|
+
YAML.load_file('config/secrets/circle_ci/config.yaml')
|
46
92
|
|
47
|
-
t.api_token = circle_ci_config[
|
93
|
+
t.api_token = circle_ci_config['circle_ci_api_token']
|
48
94
|
t.environment_variables = {
|
49
|
-
|
50
|
-
|
51
|
-
|
95
|
+
ENCRYPTION_PASSPHRASE:
|
96
|
+
File.read('config/secrets/ci/encryption.passphrase')
|
97
|
+
.chomp
|
52
98
|
}
|
53
99
|
t.checkout_keys = []
|
54
100
|
t.ssh_keys = [
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
101
|
+
{
|
102
|
+
hostname: 'github.com',
|
103
|
+
private_key: File.read('config/secrets/ci/ssh.private')
|
104
|
+
}
|
59
105
|
]
|
60
106
|
end
|
61
107
|
|
62
108
|
RakeGithub.define_repository_tasks(
|
63
|
-
|
64
|
-
|
109
|
+
namespace: :github,
|
110
|
+
repository: 'infrablocks/rake_terraform'
|
65
111
|
) do |t|
|
66
112
|
github_config =
|
67
|
-
|
113
|
+
YAML.load_file('config/secrets/github/config.yaml')
|
68
114
|
|
69
|
-
t.access_token = github_config[
|
115
|
+
t.access_token = github_config['github_personal_access_token']
|
70
116
|
t.deploy_keys = [
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
117
|
+
{
|
118
|
+
title: 'CircleCI',
|
119
|
+
public_key: File.read('config/secrets/ci/ssh.public')
|
120
|
+
}
|
75
121
|
]
|
76
122
|
end
|
77
123
|
|
78
124
|
namespace :pipeline do
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
125
|
+
desc 'Prepare CircleCI Pipeline'
|
126
|
+
task prepare: %i[
|
127
|
+
circle_ci:project:follow
|
128
|
+
circle_ci:env_vars:ensure
|
129
|
+
circle_ci:checkout_keys:ensure
|
130
|
+
circle_ci:ssh_keys:ensure
|
131
|
+
github:deploy_keys:ensure
|
85
132
|
]
|
86
133
|
end
|
87
134
|
|
88
135
|
namespace :version do
|
89
|
-
desc
|
136
|
+
desc 'Bump version for specified type (pre, major, minor, patch)'
|
90
137
|
task :bump, [:type] do |_, args|
|
91
138
|
bump_version_for(args.type)
|
92
139
|
end
|
93
140
|
end
|
94
141
|
|
95
|
-
desc
|
142
|
+
desc 'Release gem'
|
96
143
|
task :release do
|
97
|
-
sh
|
144
|
+
sh 'gem release --tag --push'
|
98
145
|
end
|
99
146
|
|
100
147
|
def bump_version_for(version_type)
|
101
|
-
sh "gem bump --version #{version_type} "
|
102
|
-
|
103
|
-
|
104
|
-
|
148
|
+
sh "gem bump --version #{version_type} " \
|
149
|
+
'&& bundle install ' \
|
150
|
+
'&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
|
151
|
+
'&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
|
105
152
|
end
|
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'rake_terraform'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "rake/terraform"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/lib/rake_terraform.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
require 'rake_dependencies'
|
3
5
|
require 'ruby_terraform'
|
@@ -6,137 +8,54 @@ require 'rake_terraform/tasks'
|
|
6
8
|
require 'rake_terraform/task_sets'
|
7
9
|
|
8
10
|
module RakeTerraform
|
9
|
-
include RubyTerraform
|
10
|
-
|
11
11
|
def self.define_command_tasks(opts = {}, &block)
|
12
12
|
RakeTerraform::TaskSets::All.define(opts, &block)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.define_installation_tasks(opts = {})
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
namespace = opts[:namespace] || :terraform
|
20
|
-
version = opts[:version] || '0.10.3'
|
21
|
-
path = opts[:path] || File.join(Dir.pwd, 'vendor', 'terraform')
|
22
|
-
providers = opts[:providers] || []
|
23
|
-
|
24
|
-
command_task_set_opts = {
|
25
|
-
namespace: namespace,
|
26
|
-
dependency: 'terraform',
|
27
|
-
version: version,
|
28
|
-
path: path,
|
29
|
-
type: :zip,
|
30
|
-
|
31
|
-
os_ids: {mac: 'darwin', linux: 'linux'},
|
32
|
-
|
33
|
-
uri_template:
|
34
|
-
'https://releases.hashicorp.com/terraform/<%= @version %>/' +
|
35
|
-
'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>',
|
36
|
-
file_name_template:
|
37
|
-
'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>',
|
38
|
-
|
39
|
-
needs_fetch: lambda { |params|
|
40
|
-
terraform_binary = File.join(
|
41
|
-
params.path, params.binary_directory, 'terraform')
|
42
|
-
version_string = StringIO.new
|
16
|
+
command_task_set = define_command_installation_tasks(opts)
|
17
|
+
provider_task_sets = define_providers_installation_tasks(opts)
|
43
18
|
|
44
|
-
|
19
|
+
configure_ruby_terraform(command_task_set.binary)
|
20
|
+
wire_provider_ensure_tasks(opts)
|
45
21
|
|
46
|
-
|
47
|
-
|
48
|
-
.for_command(terraform_binary)
|
49
|
-
.with_flag('-version')
|
50
|
-
.build
|
51
|
-
|
52
|
-
logger.info(
|
53
|
-
'Fetching terraform version information using command: ' +
|
54
|
-
"#{command_line}")
|
55
|
-
|
56
|
-
command_line.execute(stdout: version_string)
|
57
|
-
|
58
|
-
logger.info(
|
59
|
-
"Terraform version information is: \n#{version_string.string}")
|
60
|
-
|
61
|
-
version_line = version_string.string.lines.first
|
62
|
-
version_is_correct = version_line =~ /#{version}/
|
63
|
-
|
64
|
-
logger.debug(
|
65
|
-
"Version: '#{version}' is in version line: " +
|
66
|
-
"'#{version_line}'?: #{version_is_correct}")
|
67
|
-
|
68
|
-
return !version_is_correct
|
69
|
-
end
|
22
|
+
[command_task_set.delegate, provider_task_sets.map(&:delegate)]
|
23
|
+
end
|
70
24
|
|
71
|
-
|
72
|
-
|
73
|
-
}
|
25
|
+
class << self
|
26
|
+
private
|
74
27
|
|
75
|
-
|
76
|
-
|
28
|
+
def define_command_installation_tasks(opts = {})
|
29
|
+
RakeTerraform::TaskSets::Terraform.define(opts)
|
77
30
|
end
|
78
31
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
provider_task_sets = providers.map do |provider|
|
83
|
-
dependency = "terraform-provider-#{provider[:name]}"
|
84
|
-
provider_task_set_opts = {
|
85
|
-
namespace: provider[:name],
|
86
|
-
dependency: dependency,
|
87
|
-
version: provider[:version],
|
88
|
-
path: provider[:path] || File.join('vendor', dependency),
|
89
|
-
type: :tar_gz,
|
90
|
-
|
91
|
-
os_ids: {mac: 'darwin', linux: 'linux'},
|
92
|
-
|
93
|
-
uri_template:
|
94
|
-
"https://github.com/#{provider[:repository]}/releases/" +
|
95
|
-
"download/<%= @version %>/" +
|
96
|
-
"#{dependency}_v<%= @version %>_<%= @os_id %>" +
|
97
|
-
"_amd64<%= @ext %>",
|
98
|
-
file_name_template:
|
99
|
-
"#{dependency}_v<%= @version %>_<%= @os_id %>_amd64<%= @ext %>",
|
100
|
-
|
101
|
-
source_binary_name_template: dependency,
|
102
|
-
target_binary_name_template: "#{dependency}_v<%= @version %>",
|
103
|
-
|
104
|
-
installation_directory: "#{ENV['HOME']}/.terraform.d/plugins",
|
105
|
-
|
106
|
-
needs_fetch: lambda { |params|
|
107
|
-
provider_binary = File.join(
|
108
|
-
params.path,
|
109
|
-
params.binary_directory,
|
110
|
-
"#{dependency}_v#{params.version}")
|
111
|
-
|
112
|
-
logger.info(
|
113
|
-
"Terraform provider binary for: #{provider.name} " +
|
114
|
-
"should be at: #{provider_binary}")
|
115
|
-
|
116
|
-
binary_exists = File.exists?(provider_binary)
|
117
|
-
|
118
|
-
logger.debug("Provider file exists?: #{binary_exists}")
|
119
|
-
|
120
|
-
!binary_exists
|
121
|
-
}
|
122
|
-
}
|
32
|
+
def define_provider_installation_tasks(opts = {})
|
33
|
+
RakeTerraform::TaskSets::Provider.define(opts)
|
34
|
+
end
|
123
35
|
|
124
|
-
|
125
|
-
|
36
|
+
def define_providers_installation_tasks(opts = {})
|
37
|
+
namespace = opts[:namespace] || :terraform
|
38
|
+
providers = opts[:providers] || []
|
126
39
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
40
|
+
providers.map do |provider_opts|
|
41
|
+
define_provider_installation_tasks(
|
42
|
+
{ parent_namespace: namespace }.merge(provider_opts)
|
43
|
+
)
|
131
44
|
end
|
45
|
+
end
|
132
46
|
|
133
|
-
|
47
|
+
def configure_ruby_terraform(binary)
|
48
|
+
RubyTerraform.configure { |c| c.binary = binary }
|
134
49
|
end
|
135
50
|
|
136
|
-
|
137
|
-
|
138
|
-
|
51
|
+
def wire_provider_ensure_tasks(opts)
|
52
|
+
namespace = opts[:namespace] || :terraform
|
53
|
+
providers = opts[:providers] || []
|
139
54
|
|
140
|
-
|
55
|
+
Rake::Task["#{namespace}:ensure"]
|
56
|
+
.enhance(providers.map do |provider_opts|
|
57
|
+
"#{namespace}:providers:#{provider_opts[:name]}:ensure"
|
58
|
+
end)
|
59
|
+
end
|
141
60
|
end
|
142
61
|
end
|