ruby-terraform 0.27.0.pre.pre.2 → 0.29.0.pre.pre.1
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/.circleci/config.yml +3 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/README.md +123 -37
- data/lib/ruby_terraform.rb +11 -2
- data/lib/ruby_terraform/commands/base.rb +7 -4
- data/lib/ruby_terraform/commands/output.rb +3 -2
- data/lib/ruby_terraform/commands/plan.rb +2 -1
- data/lib/ruby_terraform/commands/refresh.rb +2 -3
- data/lib/ruby_terraform/commands/remote_config.rb +2 -1
- data/lib/ruby_terraform/commands/show.rb +0 -1
- data/lib/ruby_terraform/commands/validate.rb +4 -2
- data/lib/ruby_terraform/commands/workspace.rb +4 -1
- data/lib/ruby_terraform/version.rb +1 -1
- data/ruby_terraform.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74107c0345d78776629e585ed00cdbc3fd74a8170740a63827ca1004357aed9e
|
4
|
+
data.tar.gz: b5cdca917a58b422cf047de27c3f705c83dd779573892e3b2b0f57df84100ba3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa73debf4732ee55b3b2c71d67ffc7919f28e021b4c31d3bc9e8c5564549484dc530735c57ff6b6ef6465295b75a202e17fbe9265e70f4b16c94648fecf8b04d
|
7
|
+
data.tar.gz: bc838afc7bd52bf784f2c7474be28885489923939a9bc7e363ebe4debb604d9b0afee66a6c6ebd354961fcd69008516e09d71e0b2967ecd15256038b9b90b2dc
|
data/.circleci/config.yml
CHANGED
@@ -3,14 +3,14 @@ jobs:
|
|
3
3
|
test:
|
4
4
|
working_directory: ~/ruby-terraform
|
5
5
|
docker:
|
6
|
-
- image: ruby:2.
|
6
|
+
- image: ruby:2.4.7
|
7
7
|
steps:
|
8
8
|
- checkout
|
9
9
|
- run: ./scripts/ci/steps/test.sh
|
10
10
|
prerelease:
|
11
11
|
working_directory: ~/ruby-terraform
|
12
12
|
docker:
|
13
|
-
- image: ruby:2.
|
13
|
+
- image: ruby:2.4.7
|
14
14
|
steps:
|
15
15
|
- checkout
|
16
16
|
- run: ./scripts/ci/common/install-git-crypt.sh
|
@@ -21,7 +21,7 @@ jobs:
|
|
21
21
|
release:
|
22
22
|
working_directory: ~/ruby-terraform
|
23
23
|
docker:
|
24
|
-
- image: ruby:2.
|
24
|
+
- image: ruby:2.4.7
|
25
25
|
steps:
|
26
26
|
- checkout
|
27
27
|
- run: ./scripts/ci/common/install-git-crypt.sh
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.7
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-terraform (0.
|
4
|
+
ruby-terraform (0.29.0.pre.pre.1)
|
5
5
|
lino (~> 1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
concurrent-ruby (1.1.
|
10
|
+
concurrent-ruby (1.1.5)
|
11
11
|
diff-lcs (1.3)
|
12
12
|
gem-release (2.0.1)
|
13
13
|
hamster (3.0.0)
|
@@ -35,11 +35,11 @@ PLATFORMS
|
|
35
35
|
ruby
|
36
36
|
|
37
37
|
DEPENDENCIES
|
38
|
-
bundler (~>
|
38
|
+
bundler (~> 2.0)
|
39
39
|
gem-release (~> 2.0)
|
40
40
|
rake (~> 12.3)
|
41
41
|
rspec (~> 3.8)
|
42
42
|
ruby-terraform!
|
43
43
|
|
44
44
|
BUNDLED WITH
|
45
|
-
|
45
|
+
2.0.2
|
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
A simple wrapper around the Terraform binary to allow execution from within
|
4
4
|
a Ruby program or Rakefile.
|
5
5
|
|
6
|
+
|
6
7
|
## Installation
|
7
8
|
|
8
9
|
Add this line to your application's Gemfile:
|
@@ -32,7 +33,7 @@ RubyTerraform.configure do |config|
|
|
32
33
|
end
|
33
34
|
```
|
34
35
|
|
35
|
-
In addition, each command that requires the terraform binary (all except
|
36
|
+
In addition, each command that requires the terraform binary (all except
|
36
37
|
`clean`) takes a `binary` keyword argument at initialisation that overrides the
|
37
38
|
global configuration value.
|
38
39
|
|
@@ -43,9 +44,11 @@ Currently, there is partial support for the following commands:
|
|
43
44
|
* `RubyTerraform::Commands::Get`: executes `terraform get`
|
44
45
|
* `RubyTerraform::Commands::Plan`: executes `terraform plan`
|
45
46
|
* `RubyTerraform::Commands::Apply`: executes `terraform apply`
|
47
|
+
* `RubyTerraform::Commands::Show`: executes `terraform show`
|
46
48
|
* `RubyTerraform::Commands::Destroy`: executes `terraform destroy`
|
47
49
|
* `RubyTerraform::Commands::Output`: executes `terraform output`
|
48
50
|
* `RubyTerraform::Commands::RemoteConfig`: executes `terraform remote config`
|
51
|
+
* `RubyTerraform::Commands::Validate`: executes `terraform validate`
|
49
52
|
* `RubyTerraform::Commands::Workspace`: executes `terraform workspace`
|
50
53
|
|
51
54
|
### RubyTerraform::Commands::Clean
|
@@ -66,7 +69,7 @@ removes the specified directory.
|
|
66
69
|
|
67
70
|
### RubyTerraform::Commands::Init
|
68
71
|
|
69
|
-
The init command will initialise a terraform environment. It can be called in
|
72
|
+
The init command will initialise a terraform environment. It can be called in
|
70
73
|
the following ways:
|
71
74
|
|
72
75
|
```ruby
|
@@ -74,12 +77,12 @@ RubyTerraform.init
|
|
74
77
|
RubyTerraform.init(source: 'some/module/path', path: 'infra/module')
|
75
78
|
RubyTerraform::Commands::Init.new.execute
|
76
79
|
RubyTerraform::Commands::Init.new.execute(
|
77
|
-
source: 'some/module/path',
|
80
|
+
source: 'some/module/path',
|
78
81
|
path: 'infra/module')
|
79
82
|
```
|
80
83
|
|
81
84
|
The init command supports the following options passed as keyword arguments:
|
82
|
-
* `source`: the source module to use to initialise; required if `path` is
|
85
|
+
* `source`: the source module to use to initialise; required if `path` is
|
83
86
|
specified
|
84
87
|
* `path`: the path to initialise.
|
85
88
|
* `backend`: `true`/`false`, whether or not to configure the backend.
|
@@ -103,12 +106,12 @@ RubyTerraform::Commands::Get.new.execute(directory: 'infra/networking')
|
|
103
106
|
|
104
107
|
The get command supports the following options passed as keyword arguments:
|
105
108
|
* `directory`: the directory containing terraform configuration; required.
|
106
|
-
* `update`: whether or not already downloaded modules should be updated;
|
109
|
+
* `update`: whether or not already downloaded modules should be updated;
|
107
110
|
defaults to `false`.
|
108
111
|
* `no_color`: whether or not the output from the command should be in color;
|
109
112
|
defaults to `false`.
|
110
|
-
|
111
|
-
|
113
|
+
|
114
|
+
|
112
115
|
### RubyTerraform::Commands::Plan
|
113
116
|
|
114
117
|
The plan command will generate the execution plan in the provided
|
@@ -116,7 +119,7 @@ configuration directory. It can be called in the following ways:
|
|
116
119
|
|
117
120
|
```ruby
|
118
121
|
RubyTerraform.plan(
|
119
|
-
directory: 'infra/networking',
|
122
|
+
directory: 'infra/networking',
|
120
123
|
vars: {
|
121
124
|
region: 'eu-central'
|
122
125
|
})
|
@@ -130,20 +133,21 @@ RubyTerraform::Commands::Plan.new.execute(
|
|
130
133
|
The plan command supports the following options passed as keyword arguments:
|
131
134
|
* `directory`: the directory containing terraform configuration; required.
|
132
135
|
* `vars`: a map of vars to be passed in to the terraform configuration.
|
133
|
-
* `var_file`: the path to a terraform var file; if both `var_file` and
|
136
|
+
* `var_file`: the path to a terraform var file; if both `var_file` and
|
134
137
|
`var_files` are provided, all var files will be passed to terraform.
|
135
|
-
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
138
|
+
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
136
139
|
`var_files` are provided, all var files will be passed to terraform.
|
137
140
|
* `state`: the path to the state file in which to store state; defaults to
|
138
141
|
terraform.tfstate in the working directory or the remote state if configured.
|
139
142
|
* `plan`: the name of the file in which to save the generated plan.
|
140
|
-
* `input`: when `false`, will not ask for input for variables not directly set;
|
143
|
+
* `input`: when `false`, will not ask for input for variables not directly set;
|
144
|
+
defaults to `true`.
|
141
145
|
* `destroy`: when `true`, a plan will be generated to destroy all resources
|
142
146
|
managed by the given configuration and state; defaults to `false`.
|
143
147
|
* `no_color`: whether or not the output from the command should be in color;
|
144
148
|
defaults to `false`.
|
145
|
-
|
146
|
-
|
149
|
+
|
150
|
+
|
147
151
|
### RubyTerraform::Commands::Apply
|
148
152
|
|
149
153
|
The apply command applies terraform configuration in the provided terraform
|
@@ -151,7 +155,7 @@ configuration directory. It can be called in the following ways:
|
|
151
155
|
|
152
156
|
```ruby
|
153
157
|
RubyTerraform.apply(
|
154
|
-
directory: 'infra/networking',
|
158
|
+
directory: 'infra/networking',
|
155
159
|
vars: {
|
156
160
|
region: 'eu-central'
|
157
161
|
})
|
@@ -165,19 +169,20 @@ RubyTerraform::Commands::Apply.new.execute(
|
|
165
169
|
The apply command supports the following options passed as keyword arguments:
|
166
170
|
* `directory`: the directory containing terraform configuration; required.
|
167
171
|
* `vars`: a map of vars to be passed in to the terraform configuration.
|
168
|
-
* `var_file`: the path to a terraform var file; if both `var_file` and
|
172
|
+
* `var_file`: the path to a terraform var file; if both `var_file` and
|
173
|
+
`var_files` are provided, all var files will be passed to terraform.
|
174
|
+
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
169
175
|
`var_files` are provided, all var files will be passed to terraform.
|
170
|
-
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
171
|
-
`var_files` are provided, all var files will be passed to terraform.
|
172
176
|
* `state`: the path to the state file in which to store state; defaults to
|
173
177
|
terraform.tfstate in the working directory or the remote state if configured.
|
174
178
|
* `backup`: the path to the backup file in which to store the state backup.
|
175
|
-
* `input`: when `false`, will not ask for input for variables not directly set;
|
179
|
+
* `input`: when `false`, will not ask for input for variables not directly set;
|
180
|
+
defaults to `true`.
|
176
181
|
* `no_backup`: when `true`, no backup file will be written; defaults to `false`.
|
177
182
|
* `no_color`: whether or not the output from the command should be in color;
|
178
183
|
defaults to `false`.
|
179
|
-
* `auto_approve`: if `true`, the command applys without prompting the user to
|
180
|
-
the changes; defaults to `false`.
|
184
|
+
* `auto_approve`: if `true`, the command applys without prompting the user to
|
185
|
+
confirm the changes; defaults to `false`.
|
181
186
|
|
182
187
|
|
183
188
|
### RubyTerraform::Commands::Destroy
|
@@ -188,7 +193,7 @@ called in the following ways:
|
|
188
193
|
|
189
194
|
```ruby
|
190
195
|
RubyTerraform.destroy(
|
191
|
-
directory: 'infra/networking',
|
196
|
+
directory: 'infra/networking',
|
192
197
|
vars: {
|
193
198
|
region: 'eu-central'
|
194
199
|
})
|
@@ -202,10 +207,10 @@ RubyTerraform::Commands::Destroy.new.execute(
|
|
202
207
|
The destroy command supports the following options passed as keyword arguments:
|
203
208
|
* `directory`: the directory containing terraform configuration; required.
|
204
209
|
* `vars`: a map of vars to be passed in to the terraform configuration.
|
205
|
-
* `var_file`: the path to a terraform var file; if both `var_file` and
|
210
|
+
* `var_file`: the path to a terraform var file; if both `var_file` and
|
211
|
+
`var_files` are provided, all var files will be passed to terraform.
|
212
|
+
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
206
213
|
`var_files` are provided, all var files will be passed to terraform.
|
207
|
-
* `var_files`: an array of paths to terraform var files; if both `var_file` and
|
208
|
-
`var_files` are provided, all var files will be passed to terraform.
|
209
214
|
* `state`: the path to the state file containing the current state; defaults to
|
210
215
|
terraform.tfstate in the working directory or the remote state if configured.
|
211
216
|
* `force`: if `true`, the command destroys without prompting the user to confirm
|
@@ -260,32 +265,113 @@ RubyTerraform::Commands::RemoteConfig.new.execute(
|
|
260
265
|
The remote config command supports the following options passed as keyword
|
261
266
|
arguments:
|
262
267
|
* `backend`: the type of backend to use; required.
|
263
|
-
* `backend_config`: a map of backend specific configuration parameters;
|
268
|
+
* `backend_config`: a map of backend specific configuration parameters;
|
264
269
|
required.
|
265
270
|
* `no_color`: whether or not the output from the command should be in color;
|
266
271
|
defaults to `false`.
|
267
272
|
|
273
|
+
|
268
274
|
### RubyTerraform::Commands::Workspace
|
269
275
|
|
270
|
-
The `workspace` command configures
|
276
|
+
The `workspace` command configures
|
277
|
+
[Terraform Workspaces](https://www.terraform.io/docs/state/workspaces.html#using-workspaces).
|
278
|
+
It can be used as follows:
|
271
279
|
|
272
280
|
```ruby
|
273
|
-
RubyTerraform.workspace(operation: 'list')
|
274
|
-
RubyTerraform.workspace(operation: 'new', workspace: 'staging')
|
275
|
-
RubyTerraform.workspace(operation: 'select', workspace: 'staging')
|
276
|
-
RubyTerraform.workspace(operation: 'list')
|
277
|
-
RubyTerraform.workspace(operation: 'select', workspace: 'default')
|
278
|
-
RubyTerraform.workspace(operation: 'delete', workspace: 'staging')
|
281
|
+
RubyTerraform.workspace(operation: 'list')
|
282
|
+
RubyTerraform.workspace(operation: 'new', workspace: 'staging')
|
283
|
+
RubyTerraform.workspace(operation: 'select', workspace: 'staging')
|
284
|
+
RubyTerraform.workspace(operation: 'list')
|
285
|
+
RubyTerraform.workspace(operation: 'select', workspace: 'default')
|
286
|
+
RubyTerraform.workspace(operation: 'delete', workspace: 'staging')
|
279
287
|
```
|
280
288
|
|
281
|
-
|
282
|
-
* `directory`: the directory containing terraform configuration, the default is
|
289
|
+
arguments:
|
290
|
+
* `directory`: the directory containing terraform configuration, the default is
|
291
|
+
the current path.
|
283
292
|
* `operation`: `list`, `select`, `new` or `delete`. default `list`.
|
284
293
|
* `workspace`: Workspace name.
|
285
294
|
|
295
|
+
|
296
|
+
## Configuration
|
297
|
+
|
298
|
+
In addition to configuring the location of the terraform binary, RubyTerraform
|
299
|
+
offers configuration of logging and standard streams. By default standard
|
300
|
+
streams map to `$stdin`, `$stdout` and `$stderr` and all logging goes to
|
301
|
+
`$stdout`.
|
302
|
+
|
303
|
+
### Logging
|
304
|
+
|
305
|
+
By default, RubyTerraform logs to `$stdout` with level `info`.
|
306
|
+
|
307
|
+
To configure a custom logger:
|
308
|
+
|
309
|
+
``` ruby
|
310
|
+
require 'logger'
|
311
|
+
|
312
|
+
logger = Logger.new($stdout)
|
313
|
+
logger.level = Logger::DEBUG
|
314
|
+
|
315
|
+
RubyTerraform.configure do |config|
|
316
|
+
config.logger = logger
|
317
|
+
end
|
318
|
+
```
|
319
|
+
|
320
|
+
RubyTerraform supports logging to multiple different outputs at once,
|
321
|
+
for example:
|
322
|
+
|
323
|
+
``` ruby
|
324
|
+
require 'logger'
|
325
|
+
|
326
|
+
log_file = File.open('path/to/some/ruby_terraform.log', 'a')
|
327
|
+
logger = Logger.new(
|
328
|
+
RubyTerraform::MultiIO.new($stdout, log_file))
|
329
|
+
logger.level = Logger::DEBUG
|
330
|
+
|
331
|
+
RubyTerraform.configure do |config|
|
332
|
+
config.logger = logger
|
333
|
+
end
|
334
|
+
```
|
335
|
+
|
336
|
+
Configured in this way, any logging performed by RubyTerraform will log to both
|
337
|
+
`STDOUT` and the provided `log_file`.
|
338
|
+
|
339
|
+
### Standard Streams
|
340
|
+
|
341
|
+
By default, RubyTerraform uses streams `$stdin`, `$stdout` and `$stderr`.
|
342
|
+
|
343
|
+
To configure custom output and error streams:
|
344
|
+
|
345
|
+
``` ruby
|
346
|
+
log_file = File.open('path/to/some/ruby_terraform.log', 'a')
|
347
|
+
|
348
|
+
RubyTerraform.configure do |config|
|
349
|
+
config.stdout = log_file
|
350
|
+
config.stderr = log_file
|
351
|
+
end
|
352
|
+
```
|
353
|
+
|
354
|
+
In this way, both outputs will be redirected to `log_file`.
|
355
|
+
|
356
|
+
Similarly, a custom input stream can be configured:
|
357
|
+
|
358
|
+
``` ruby
|
359
|
+
require 'stringio'
|
360
|
+
|
361
|
+
input = StringIO.new("user\ninput\n")
|
362
|
+
|
363
|
+
RubyTerraform.configure do |config|
|
364
|
+
config.stdin = input
|
365
|
+
end
|
366
|
+
```
|
367
|
+
|
368
|
+
In this way, terraform can be driven by input from somewhere other than
|
369
|
+
interactive input from the terminal.
|
370
|
+
|
371
|
+
|
286
372
|
## Development
|
287
373
|
|
288
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
374
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then,
|
289
375
|
run `rake spec` to run the tests. You can also run `bin/console` for an
|
290
376
|
interactive prompt that will allow you to experiment.
|
291
377
|
|
@@ -320,7 +406,7 @@ openssl aes-256-cbc \
|
|
320
406
|
|
321
407
|
## Contributing
|
322
408
|
|
323
|
-
Bug reports and pull requests are welcome on GitHub at
|
409
|
+
Bug reports and pull requests are welcome on GitHub at
|
324
410
|
https://github.com/infrablocks/ruby_terraform. This project is intended to be a
|
325
411
|
safe, welcoming space for collaboration, and contributors are expected to adhere
|
326
412
|
to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -328,5 +414,5 @@ to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
328
414
|
|
329
415
|
## License
|
330
416
|
|
331
|
-
The gem is available as open source under the terms of the
|
417
|
+
The gem is available as open source under the terms of the
|
332
418
|
[MIT License](http://opensource.org/licenses/MIT).
|
data/lib/ruby_terraform.rb
CHANGED
@@ -80,11 +80,20 @@ module RubyTerraform
|
|
80
80
|
end
|
81
81
|
|
82
82
|
class Configuration
|
83
|
-
attr_accessor :binary, :logger
|
83
|
+
attr_accessor :binary, :logger, :stdin, :stdout, :stderr
|
84
|
+
|
85
|
+
def default_logger
|
86
|
+
logger = Logger.new($stdout)
|
87
|
+
logger.level = Logger::INFO
|
88
|
+
logger
|
89
|
+
end
|
84
90
|
|
85
91
|
def initialize
|
86
92
|
@binary = 'terraform'
|
87
|
-
@logger =
|
93
|
+
@logger = default_logger
|
94
|
+
@stdin = $stdin
|
95
|
+
@stdout = $stdout
|
96
|
+
@stderr = $stderr
|
88
97
|
end
|
89
98
|
end
|
90
99
|
|
@@ -5,21 +5,24 @@ module RubyTerraform
|
|
5
5
|
class Base
|
6
6
|
attr_reader :binary
|
7
7
|
|
8
|
-
def initialize(binary: nil, logger: nil)
|
8
|
+
def initialize(binary: nil, logger: nil, stdin: nil, stdout: nil, stderr: nil)
|
9
9
|
@binary = binary || RubyTerraform.configuration.binary
|
10
10
|
@logger = logger || RubyTerraform.configuration.logger
|
11
|
+
@stdin = stdin || RubyTerraform.configuration.stdin
|
12
|
+
@stdout = stdout || RubyTerraform.configuration.stdout
|
13
|
+
@stderr = stderr || RubyTerraform.configuration.stderr
|
11
14
|
end
|
12
15
|
|
13
16
|
def stdin
|
14
|
-
|
17
|
+
@stdin
|
15
18
|
end
|
16
19
|
|
17
20
|
def stdout
|
18
|
-
|
21
|
+
@stdout
|
19
22
|
end
|
20
23
|
|
21
24
|
def stderr
|
22
|
-
|
25
|
+
@stderr
|
23
26
|
end
|
24
27
|
|
25
28
|
def execute(opts = {})
|
@@ -6,7 +6,8 @@ module RubyTerraform
|
|
6
6
|
module Commands
|
7
7
|
class Output < Base
|
8
8
|
def stdout
|
9
|
-
@stdout
|
9
|
+
@stdout = StringIO.new unless
|
10
|
+
defined?(@stdout) && @stdout.respond_to?(:string)
|
10
11
|
end
|
11
12
|
|
12
13
|
def configure_command(builder, opts)
|
@@ -27,7 +28,7 @@ module RubyTerraform
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def do_after(opts)
|
30
|
-
result = stdout.string
|
31
|
+
result = @stdout.string
|
31
32
|
opts[:name] ? result.chomp : result
|
32
33
|
end
|
33
34
|
end
|
@@ -18,7 +18,8 @@ module RubyTerraform
|
|
18
18
|
builder
|
19
19
|
.with_subcommand('plan') do |sub|
|
20
20
|
vars.each do |key, value|
|
21
|
-
sub = sub.with_option(
|
21
|
+
sub = sub.with_option(
|
22
|
+
'-var', "'#{key}=#{value}'", separator: ' ')
|
22
23
|
end
|
23
24
|
sub = sub.with_option('-var-file', var_file) if var_file
|
24
25
|
var_files.each do |file|
|
@@ -10,16 +10,15 @@ module RubyTerraform
|
|
10
10
|
var_file = opts[:var_file]
|
11
11
|
var_files = opts[:var_files] || []
|
12
12
|
state = opts[:state]
|
13
|
-
refresh = opts[:refresh]
|
14
13
|
input = opts[:input]
|
15
14
|
target = opts[:target]
|
16
|
-
destroy = opts[:destroy]
|
17
15
|
no_color = opts[:no_color]
|
18
16
|
|
19
17
|
builder
|
20
18
|
.with_subcommand('refresh') do |sub|
|
21
19
|
vars.each do |key, value|
|
22
|
-
sub = sub.with_option(
|
20
|
+
sub = sub.with_option(
|
21
|
+
'-var', "'#{key}=#{value}'", separator: ' ')
|
23
22
|
end
|
24
23
|
sub = sub.with_option('-var-file', var_file) if var_file
|
25
24
|
var_files.each do |file|
|
@@ -14,7 +14,8 @@ module RubyTerraform
|
|
14
14
|
.with_subcommand('config') do |sub|
|
15
15
|
sub = sub.with_option('-backend', backend) if backend
|
16
16
|
backend_config.each do |key, value|
|
17
|
-
sub = sub.with_option(
|
17
|
+
sub = sub.with_option(
|
18
|
+
'-backend-config', "'#{key}=#{value}'", separator: ' ')
|
18
19
|
end
|
19
20
|
|
20
21
|
sub = sub.with_flag('-no-color') if no_color
|
@@ -16,14 +16,16 @@ module RubyTerraform
|
|
16
16
|
builder
|
17
17
|
.with_subcommand('validate') do |sub|
|
18
18
|
vars.each do |key, value|
|
19
|
-
sub = sub.with_option(
|
19
|
+
sub = sub.with_option(
|
20
|
+
'-var', "'#{key}=#{value}'", separator: ' ')
|
20
21
|
end
|
21
22
|
sub = sub.with_option('-var-file', var_file) if var_file
|
22
23
|
var_files.each do |file|
|
23
24
|
sub = sub.with_option('-var-file', file)
|
24
25
|
end
|
25
26
|
sub = sub.with_option('-state', state) if state
|
26
|
-
sub = sub.with_option('-check-variables', check_variables) unless
|
27
|
+
sub = sub.with_option('-check-variables', check_variables) unless
|
28
|
+
check_variables.nil?
|
27
29
|
sub = sub.with_flag('-no-color') if no_color
|
28
30
|
sub
|
29
31
|
end
|
@@ -13,8 +13,11 @@ module RubyTerraform
|
|
13
13
|
.with_subcommand('workspace')
|
14
14
|
.with_subcommand(operation)
|
15
15
|
|
16
|
-
builder = builder.with_subcommand(workspace) if
|
16
|
+
builder = builder.with_subcommand(workspace) if
|
17
|
+
workspace && operation != 'list'
|
17
18
|
builder = builder.with_argument(directory)
|
19
|
+
|
20
|
+
builder
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
data/ruby_terraform.gemspec
CHANGED
@@ -23,11 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f)}
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.required_ruby_version = '>= 2.
|
26
|
+
spec.required_ruby_version = '>= 2.4.7'
|
27
27
|
|
28
28
|
spec.add_dependency 'lino', '~> 1.1'
|
29
29
|
|
30
|
-
spec.add_development_dependency 'bundler', '~>
|
30
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
31
|
spec.add_development_dependency 'rake', '~> 12.3'
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.8'
|
33
33
|
spec.add_development_dependency 'gem-release', '~> 2.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.29.0.pre.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
152
152
|
requirements:
|
153
153
|
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version: 2.
|
155
|
+
version: 2.4.7
|
156
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">"
|