ruby-terraform 0.65.0.pre.14 → 0.65.0.pre.15
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/README.md +2 -19
- data/lib/ruby_terraform.rb +606 -16
- data/lib/ruby_terraform/commands/apply.rb +2 -2
- data/lib/ruby_terraform/commands/destroy.rb +67 -1
- data/lib/ruby_terraform/commands/force_unlock.rb +28 -0
- data/lib/ruby_terraform/commands/format.rb +39 -0
- data/lib/ruby_terraform/commands/get.rb +31 -0
- data/lib/ruby_terraform/commands/graph.rb +38 -0
- data/lib/ruby_terraform/commands/import.rb +95 -1
- data/lib/ruby_terraform/commands/init.rb +72 -1
- data/lib/ruby_terraform/commands/login.rb +24 -0
- data/lib/ruby_terraform/commands/logout.rb +21 -0
- data/lib/ruby_terraform/commands/output.rb +32 -0
- data/lib/ruby_terraform/commands/plan.rb +67 -1
- data/lib/ruby_terraform/commands/providers.rb +22 -0
- data/lib/ruby_terraform/commands/providers_lock.rb +66 -0
- data/lib/ruby_terraform/commands/providers_mirror.rb +42 -0
- 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: 856fa5b4cbf4a93f6a7e9d0c7abab4a25c56e362c33f1182762d9fe70f3c8520
|
4
|
+
data.tar.gz: 695688910f5e277ae91649169e1e9bbfe4ef6fe2fbc4a4c1f3b4f3b4559701b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa00badf71f9f0db717c7a06a4806e7225b6b6005f61601043af3975ebbacb6e82826d24f792a3b602365178711f3a0b4a010b642dbb5c3be300e0f8955a202
|
7
|
+
data.tar.gz: faf27462271fc0c7a04b38e0221590c33e2fb25679816317509744c3ddfd6024200587cb0c92cc3eeb7e12290a48bb105c05ddc16e3deb30144cd033889bda6e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -37,23 +37,6 @@ In addition, each command that requires the terraform binary (all except
|
|
37
37
|
`clean`) takes a `binary` keyword argument at initialisation that overrides the
|
38
38
|
global configuration value.
|
39
39
|
|
40
|
-
Currently, there is partial support for the following commands:
|
41
|
-
* `RubyTerraform::Commands::Clean`: clean up all locally held terraform state
|
42
|
-
and modules.
|
43
|
-
* `RubyTerraform::Commands::Init`: executes `terraform init`
|
44
|
-
* `RubyTerraform::Commands::Get`: executes `terraform get`
|
45
|
-
* `RubyTerraform::Commands::Plan`: executes `terraform plan`
|
46
|
-
* `RubyTerraform::Commands::Apply`: executes `terraform apply`
|
47
|
-
* `RubyTerraform::Commands::Show`: executes `terraform show`
|
48
|
-
* `RubyTerraform::Commands::Destroy`: executes `terraform destroy`
|
49
|
-
* `RubyTerraform::Commands::Output`: executes `terraform output`
|
50
|
-
* `RubyTerraform::Commands::Refresh`: executes `terraform refresh`
|
51
|
-
* `RubyTerraform::Commands::Import`: executes `terraform import`
|
52
|
-
* `RubyTerraform::Commands::RemoteConfig`: executes `terraform remote config`
|
53
|
-
* `RubyTerraform::Commands::Format`: executes `terraform fmt`
|
54
|
-
* `RubyTerraform::Commands::Validate`: executes `terraform validate`
|
55
|
-
* `RubyTerraform::Commands::Workspace`: executes `terraform workspace`
|
56
|
-
|
57
40
|
### RubyTerraform::Commands::Clean
|
58
41
|
|
59
42
|
The clean command can be called in the following ways:
|
@@ -325,14 +308,14 @@ RubyTerraform.import(
|
|
325
308
|
id: 'a-resource-id',
|
326
309
|
vars: {
|
327
310
|
region: 'eu-central'
|
328
|
-
})
|
311
|
+
})
|
329
312
|
RubyTerraform::Commands::Import.new.execute(
|
330
313
|
directory: 'infra/networking',
|
331
314
|
address: 'a.resource.address',
|
332
315
|
id: 'a-resource-id',
|
333
316
|
vars: {
|
334
317
|
region: 'eu-central'
|
335
|
-
})
|
318
|
+
})
|
336
319
|
```
|
337
320
|
|
338
321
|
The import command supports the following options passed as keyword arguments:
|
data/lib/ruby_terraform.rb
CHANGED
@@ -38,14 +38,14 @@ module RubyTerraform
|
|
38
38
|
# configuration; required unless +:plan+ is provided.
|
39
39
|
# @option parameters [String] :plan The path to a pre-computed plan to be
|
40
40
|
# applied; required unless +:directory+ is provided.
|
41
|
+
# @option parameters [String] :chdir The path of a working directory to
|
42
|
+
# switch to before executing the given subcommand.
|
41
43
|
# @option parameters [Boolean] :auto_approve (false) If +true+, skips
|
42
44
|
# interactive approval of the generated plan before applying.
|
43
45
|
# @option parameters [String] :backup The path to backup the existing state
|
44
46
|
# file before modifying; defaults to the +:state_out+ path with
|
45
47
|
# +".backup"+ extension; set +:no_backup+ to +true+ to skip backups
|
46
48
|
# entirely.
|
47
|
-
# @option parameters [String] :chdir The path of a working directory to
|
48
|
-
# switch to before executing the given subcommand.
|
49
49
|
# @option parameters [Boolean] :compact_warnings (false) When +true+, if
|
50
50
|
# terraform produces any warnings that are not accompanied by errors,
|
51
51
|
# they are shown in a more compact form that includes only the summary
|
@@ -97,22 +97,612 @@ module RubyTerraform
|
|
97
97
|
exec(RubyTerraform::Commands::Apply, parameters)
|
98
98
|
end
|
99
99
|
|
100
|
+
# Invokes the +terraform destroy+ command which destroys terraform managed
|
101
|
+
# infrastructure.
|
102
|
+
#
|
103
|
+
# @param parameters The parameters used to invoke the command
|
104
|
+
# @option parameters [String] :directory The directory containing terraform
|
105
|
+
# configuration; required.
|
106
|
+
# @option parameters [String] :chdir The path of a working directory to
|
107
|
+
# switch to before executing the given subcommand.
|
108
|
+
# @option parameters [Boolean] :auto_approve (false) If +true+, skips
|
109
|
+
# interactive approval before destroying.
|
110
|
+
# @option parameters [String] :backup The path to backup the existing state
|
111
|
+
# file before modifying; defaults to the +:state_out+ path with
|
112
|
+
# +".backup"+ extension; set +:no_backup+ to +true+ to skip backups
|
113
|
+
# entirely (legacy).
|
114
|
+
# @option parameters [Boolean] :compact_warnings (false) When +true+, if
|
115
|
+
# terraform produces any warnings that are not accompanied by errors,
|
116
|
+
# they are shown in a more compact form that includes only the summary
|
117
|
+
# messages.
|
118
|
+
# @option parameters [Boolean] :input (true) When +false+, will not ask for
|
119
|
+
# input for variables not directly set.
|
120
|
+
# @option parameters [Boolean] :lock (true) When +true+, locks the state
|
121
|
+
# file when locking is supported; when +false+, does not lock the state
|
122
|
+
# file.
|
123
|
+
# @option parameters [String] :lock_timeout ("0s") The duration to retry a
|
124
|
+
# state lock.
|
125
|
+
# @option parameters [Boolean] :no_backup (false) When +true+, no backup
|
126
|
+
# file will be written (legacy).
|
127
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
128
|
+
# from the command should be in color.
|
129
|
+
# @option parameters [Integer] :parallelism (10) The number of parallel
|
130
|
+
# resource operations.
|
131
|
+
# @option parameters [Boolean] :refresh (true) When +true+, updates state
|
132
|
+
# prior to checking for differences; when +false+ uses locally available
|
133
|
+
# state.
|
134
|
+
# @option parameters [String] :state ("terraform.tfstate") The path to the
|
135
|
+
# state file from which to read state and in which to store state (unless
|
136
|
+
# +:state_out+ is specified) (legacy).
|
137
|
+
# @option parameters [String] :state_out The path to write state to that is
|
138
|
+
# different than +:state+; this can be used to preserve the old state
|
139
|
+
# (legacy).
|
140
|
+
# @option parameters [String] :target The address of a resource to target;
|
141
|
+
# if both +:target+ and +:targets+ are provided, all targets will be
|
142
|
+
# passed to terraform.
|
143
|
+
# @option parameters [Array<String>] :targets An array of resource addresses
|
144
|
+
# to target; if both +:target+ and +:targets+ are provided, all targets
|
145
|
+
# will be passed to terraform.
|
146
|
+
# @option parameters [Hash<String, Object>] :vars A map of variables to be
|
147
|
+
# passed to the terraform configuration.
|
148
|
+
# @option parameters [String] :var_file The path to a terraform var file;
|
149
|
+
# if both +:var_file+ and +:var_files+ are provided, all var files will be
|
150
|
+
# passed to terraform.
|
151
|
+
# @option parameters [Array<String>] :var_files An array of paths to
|
152
|
+
# terraform var files; if both +:var_file+ and +:var_files+ are provided,
|
153
|
+
# all var files will be passed to terraform.
|
154
|
+
#
|
155
|
+
# @example Basic Invocation
|
156
|
+
# RubyTerraform.destroy(
|
157
|
+
# directory: 'infra/networking',
|
158
|
+
# vars: {
|
159
|
+
# region: 'eu-central'
|
160
|
+
# })
|
161
|
+
#
|
162
|
+
def destroy(parameters = {})
|
163
|
+
exec(RubyTerraform::Commands::Destroy, parameters)
|
164
|
+
end
|
165
|
+
|
166
|
+
# Invokes the +terraform force-unlock+ command which manually unlocks the
|
167
|
+
# state for the defined configuration.
|
168
|
+
#
|
169
|
+
# This will not modify your infrastructure. This command removes the lock on
|
170
|
+
# the state for the current workspace. The behavior of this lock is
|
171
|
+
# dependent on the backend being used. Local state files cannot be unlocked
|
172
|
+
# by another process.
|
173
|
+
#
|
174
|
+
# @param parameters The parameters used to invoke the command
|
175
|
+
# @option parameters [String] :lock_id The lock ID output when attempting an
|
176
|
+
# operation that failed due to a lock; required.
|
177
|
+
# @option parameters [String] :chdir The path of a working directory to
|
178
|
+
# switch to before executing the given subcommand.
|
179
|
+
# @option parameters [Boolean] :force (false) If +true+, does not ask for
|
180
|
+
# input for unlock confirmation.
|
181
|
+
#
|
182
|
+
# @example Basic Invocation
|
183
|
+
# RubyTerraform.force_unlock(
|
184
|
+
# lock_id: '50e844a7-ebb0-fcfd-da85-5cce5bd1ec90')
|
185
|
+
#
|
186
|
+
def force_unlock(parameters = {})
|
187
|
+
exec(RubyTerraform::Commands::ForceUnlock, parameters)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Invokes the +terraform fmt+ command which rewrites all terraform
|
191
|
+
# configuration files to a canonical format.
|
192
|
+
#
|
193
|
+
# Both configuration files (.tf) and variables files (.tfvars) are updated.
|
194
|
+
# JSON files (.tf.json or .tfvars.json) are not modified.
|
195
|
+
#
|
196
|
+
# If +:directory+ is not specified in the parameters map then the current
|
197
|
+
# working directory will be used. If +:directory+ is +"-"+ then content will
|
198
|
+
# be read from the standard input. The given content must be in the
|
199
|
+
# terraform language native syntax; JSON is not supported.
|
200
|
+
#
|
201
|
+
# @param parameters The parameters used to invoke the command
|
202
|
+
# @option parameters [String] :directory The directory containing terraform
|
203
|
+
# configuration.
|
204
|
+
# @option parameters [String] :chdir The path of a working directory to
|
205
|
+
# switch to before executing the given subcommand.
|
206
|
+
# @option parameters [Boolean] :list (false) If +true+, lists files whose
|
207
|
+
# formatting differs; always disabled if using standard input.
|
208
|
+
# @option parameters [Boolean] :write (false) If +true+, writes to source
|
209
|
+
# files; always disabled if using standard input or +:check+ is +true+.
|
210
|
+
# @option parameters [Boolean] :diff (false) If +true+, displays diffs of
|
211
|
+
# formatting changes.
|
212
|
+
# @option parameters [Boolean] :check (false) If +true+, checks if the input
|
213
|
+
# is formatted; if any input is not properly formatted, an
|
214
|
+
# {RubyTerraform::Errors::ExecutionError} will be thrown.
|
215
|
+
# @option parameters [Boolean] :recursive (false) If +true+, also processes
|
216
|
+
# files in subdirectories; by default, only the provided +:directory+ is
|
217
|
+
# processed.
|
218
|
+
#
|
219
|
+
# @example Basic Invocation
|
220
|
+
# RubyTerraform.format(
|
221
|
+
# directory: 'infra/networking')
|
222
|
+
#
|
223
|
+
def format(parameters = {})
|
224
|
+
exec(RubyTerraform::Commands::Format, parameters)
|
225
|
+
end
|
226
|
+
|
227
|
+
# Invokes the +terraform get+ command which downloads and installs modules
|
228
|
+
# needed for the given configuration.
|
229
|
+
#
|
230
|
+
# This recursively downloads all modules needed, such as modules imported by
|
231
|
+
# the root and so on. If a module is already downloaded, it will not be
|
232
|
+
# redownloaded or checked for updates unless +:update+ is +true+.
|
233
|
+
#
|
234
|
+
# Module installation also happens automatically by default as part of
|
235
|
+
# the {.init} command, so you should rarely need to run this command
|
236
|
+
# separately.
|
237
|
+
#
|
238
|
+
# @param parameters The parameters used to invoke the command
|
239
|
+
# @option parameters [String] :directory The directory containing terraform
|
240
|
+
# configuration; required.
|
241
|
+
# @option parameters [String] :chdir The path of a working directory to
|
242
|
+
# switch to before executing the given subcommand.
|
243
|
+
# @option parameters [Boolean] :update (false) If +true+, checks
|
244
|
+
# already-downloaded modules for available updates and installs the
|
245
|
+
# newest versions available.
|
246
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
247
|
+
# from the command should be in color.
|
248
|
+
#
|
249
|
+
# @example Basic Invocation
|
250
|
+
# RubyTerraform.get(
|
251
|
+
# directory: 'infra/networking')
|
252
|
+
#
|
253
|
+
def get(parameters = {})
|
254
|
+
exec(RubyTerraform::Commands::Get, parameters)
|
255
|
+
end
|
256
|
+
|
257
|
+
# Invokes the +terraform graph+ command which outputs the visual execution
|
258
|
+
# graph of terraform resources according to either the current configuration
|
259
|
+
# or an execution plan.
|
260
|
+
#
|
261
|
+
# The graph is outputted in DOT format. The typical program that can
|
262
|
+
# read this format is GraphViz, but many web services are also available to
|
263
|
+
# read this format.
|
264
|
+
#
|
265
|
+
# The +:type+ option can be used to control the type of graph shown.
|
266
|
+
# Terraform creates different graphs for different operations. See the
|
267
|
+
# options below for the list of types supported. The default type is
|
268
|
+
# +"plan"+ if a configuration is given, and +"apply"+ if a plan file is
|
269
|
+
# passed as an argument.
|
270
|
+
#
|
271
|
+
# @param parameters The parameters used to invoke the command
|
272
|
+
# @option parameters [String] :chdir The path of a working directory to
|
273
|
+
# switch to before executing the given subcommand.
|
274
|
+
# @option parameters [String] :plan Render the graph using the specified
|
275
|
+
# plan file instead of the configuration in the current directory.
|
276
|
+
# @option parameters [Boolean] :draw_cycles (false) If +true+, highlights
|
277
|
+
# any cycles in the graph with colored edges; this helps when diagnosing
|
278
|
+
# cycle errors.
|
279
|
+
# @option parameters [String] :type The type of graph to output; can be:
|
280
|
+
# +"plan"+, +"plan-destroy"+, +"apply"+, +"validate"+, +"input"+,
|
281
|
+
# +"refresh"+; defaults to +"apply"+ if +:plan+ is provided, +"plan"+
|
282
|
+
# otherwise.
|
283
|
+
# @option parameters [Integer] :module_depth In prior versions of terraform,
|
284
|
+
# specified the depth of modules to show in the output (deprecated).
|
285
|
+
#
|
286
|
+
# @example Basic Invocation
|
287
|
+
# RubyTerraform.graph
|
288
|
+
#
|
289
|
+
def graph(parameters = {})
|
290
|
+
exec(RubyTerraform::Commands::Graph, parameters)
|
291
|
+
end
|
292
|
+
|
293
|
+
# Invokes the +terraform import+ command which imports existing
|
294
|
+
# infrastructure into your terraform state.
|
295
|
+
#
|
296
|
+
# This will find and import the specified resource into your terraform
|
297
|
+
# state, allowing existing infrastructure to come under terraform
|
298
|
+
# management without having to be initially created by terraform.
|
299
|
+
#
|
300
|
+
# The +:address+ specified is the address to import the resource to. Please
|
301
|
+
# see the documentation online for resource addresses. The +:id+ is a
|
302
|
+
# resource-specific ID to identify that resource being imported. Please
|
303
|
+
# reference the documentation for the resource type you're importing to
|
304
|
+
# determine the ID syntax to use. It typically matches directly to the ID
|
305
|
+
# that the provider uses.
|
306
|
+
#
|
307
|
+
# The current implementation of terraform import can only import resources
|
308
|
+
# into the state. It does not generate configuration. A future version of
|
309
|
+
# terraform will also generate configuration.
|
310
|
+
#
|
311
|
+
# Because of this, prior to running terraform import it is necessary to
|
312
|
+
# write a resource configuration block for the resource manually, to which
|
313
|
+
# the imported object will be attached.
|
314
|
+
#
|
315
|
+
# This command will not modify your infrastructure, but it will make network
|
316
|
+
# requests to inspect parts of your infrastructure relevant to the resource
|
317
|
+
# being imported.
|
318
|
+
#
|
319
|
+
# @param parameters The parameters used to invoke the command
|
320
|
+
# @option parameters [String] :directory The path to a directory of
|
321
|
+
# terraform configuration files to use to configure the provider; defaults
|
322
|
+
# to the current directory; if no config files are present, they must be
|
323
|
+
# provided via the input prompts or env vars.
|
324
|
+
# @option parameters [String] :address The address to import the resource
|
325
|
+
# to; required.
|
326
|
+
# @option parameters [String] :id The resource-specific ID identifying the
|
327
|
+
# resource being imported; required.
|
328
|
+
# @option parameters [String] :chdir The path of a working directory to
|
329
|
+
# switch to before executing the given subcommand.
|
330
|
+
# @option parameters [String] :backup The path to backup the existing state
|
331
|
+
# file before modifying; defaults to the +:state_out+ path with
|
332
|
+
# +".backup"+ extension; set +:no_backup+ to +true+ to skip backups
|
333
|
+
# entirely (legacy).
|
334
|
+
# @option parameters [Boolean] :input (true) When +false+, will not ask for
|
335
|
+
# input for variables not directly set.
|
336
|
+
# @option parameters [Boolean] :lock (true) When +true+, locks the state
|
337
|
+
# file when locking is supported; when +false+, does not lock the state
|
338
|
+
# file.
|
339
|
+
# @option parameters [String] :lock_timeout ("0s") The duration to retry a
|
340
|
+
# state lock.
|
341
|
+
# @option parameters [Boolean] :no_backup (false) When +true+, no backup
|
342
|
+
# file will be written (legacy).
|
343
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
344
|
+
# from the command should be in color.
|
345
|
+
# @option parameters [Integer] :parallelism (10) The number of parallel
|
346
|
+
# resource operations.
|
347
|
+
# @option parameters [String] :provider The provider configuration to use
|
348
|
+
# when importing the object; by default, terraform uses the provider
|
349
|
+
# specified in the configuration for the target resource, and that is the
|
350
|
+
# best behavior in most cases (deprecated).
|
351
|
+
# @option parameters [String] :state ("terraform.tfstate") The path to the
|
352
|
+
# state file from which to read state and in which to store state (unless
|
353
|
+
# +:state_out+ is specified) (legacy).
|
354
|
+
# @option parameters [String] :state_out The path to write state to that is
|
355
|
+
# different than +:state+; this can be used to preserve the old state
|
356
|
+
# (legacy).
|
357
|
+
# @option parameters [Hash<String, Object>] :vars A map of variables to be
|
358
|
+
# passed to the terraform configuration.
|
359
|
+
# @option parameters [String] :var_file The path to a terraform var file;
|
360
|
+
# if both +:var_file+ and +:var_files+ are provided, all var files will be
|
361
|
+
# passed to terraform.
|
362
|
+
# @option parameters [Array<String>] :var_files An array of paths to
|
363
|
+
# terraform var files; if both +:var_file+ and +:var_files+ are provided,
|
364
|
+
# all var files will be passed to terraform.
|
365
|
+
# @option parameters [Boolean] :ignore_remote_version (false) If +true+,
|
366
|
+
# when using the enhanced remote backend with Terraform Cloud, continue
|
367
|
+
# even if remote and local Terraform versions differ; this may result in
|
368
|
+
# an unusable Terraform Cloud workspace, and should be used with extreme
|
369
|
+
# caution.
|
370
|
+
#
|
371
|
+
# @example Basic Invocation
|
372
|
+
# RubyTerraform.import(
|
373
|
+
# directory: 'infra/networking',
|
374
|
+
# address: 'a.resource.address',
|
375
|
+
# id: 'a-resource-id',
|
376
|
+
# vars: {
|
377
|
+
# region: 'eu-central'
|
378
|
+
# })
|
379
|
+
#
|
380
|
+
def import(parameters = {})
|
381
|
+
exec(RubyTerraform::Commands::Import, parameters)
|
382
|
+
end
|
383
|
+
|
384
|
+
# Invokes the +terraform init+ command which initializes a new or existing
|
385
|
+
# Terraform working directory by creating initial files, loading any remote
|
386
|
+
# state, downloading modules, etc.
|
387
|
+
#
|
388
|
+
# This is the first command that should be run for any new or existing
|
389
|
+
# Terraform configuration per machine. This sets up all the local data
|
390
|
+
# necessary to run Terraform that is typically not committed to version
|
391
|
+
# control.
|
392
|
+
#
|
393
|
+
# This command is always safe to run multiple times. Though subsequent runs
|
394
|
+
# may give errors, this command will never delete your configuration or
|
395
|
+
# state. Even so, if you have important information, please back it up prior
|
396
|
+
# to running this command, just in case.
|
397
|
+
#
|
398
|
+
# @param parameters The parameters used to invoke the command
|
399
|
+
# @option parameters [String] :path The path to initialize; defaults to the
|
400
|
+
# current directory.
|
401
|
+
# @option parameters [String] :chdir The path of a working directory to
|
402
|
+
# switch to before executing the given subcommand.
|
403
|
+
# @option parameters [Boolean] :backend (true) Whether or not to configure
|
404
|
+
# the backend for this configuration.
|
405
|
+
# @option parameters [Hash<String,Object>] :backend_config A map of backend
|
406
|
+
# specific configuration parameters.
|
407
|
+
# @option parameters [Boolean] :force_copy (false) If +true+, suppresses
|
408
|
+
# prompts about copying state data; this is equivalent to providing a
|
409
|
+
# "yes" to all confirmation prompts.
|
410
|
+
# @option parameters [String] :from_module copies the contents of the given
|
411
|
+
# module into the target directory before initialization.
|
412
|
+
# @option parameters [Boolean] :get (true) Whether or not to download any
|
413
|
+
# modules for this configuration.
|
414
|
+
# @option parameters [Boolean] :get_plugins (true) Whether or not to install
|
415
|
+
# plugins for this configuration (deprecated, removed in terraform 0.15).
|
416
|
+
# @option parameters [Boolean] :input (true) When +false+, will not ask for
|
417
|
+
# input for variables not directly set.
|
418
|
+
# @option parameters [Boolean] :lock (true) When +true+, locks the state
|
419
|
+
# file when locking is supported; when +false+, does not lock the state
|
420
|
+
# file (deprecated, removed in terraform 0.15).
|
421
|
+
# @option parameters [String] :lock_timeout ("0s") The duration to retry a
|
422
|
+
# state lock (deprecated, removed in terraform 0.15).
|
423
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
424
|
+
# from the command should be in color.
|
425
|
+
# @option parameters [String] :plugin_dir The path to a directory containing
|
426
|
+
# plugin binaries; this overrides all default search paths for plugins,
|
427
|
+
# and prevents the automatic installation of plugins.
|
428
|
+
# @option parameters [Boolean] :reconfigure (false) If +true+, reconfigures
|
429
|
+
# the backend, ignoring any saved configuration.
|
430
|
+
# @option parameters [Boolean] :upgrade (false) If +true+, when installing
|
431
|
+
# modules or plugins, ignores previously-downloaded objects and installs
|
432
|
+
# the latest version allowed within configured constraints.
|
433
|
+
# @option parameters [Boolean] :verify_plugins (true) Whether or not to
|
434
|
+
# verify plugins for this configuration (deprecated, removed in terraform
|
435
|
+
# 0.15).
|
436
|
+
#
|
437
|
+
# @example Basic Invocation
|
438
|
+
# RubyTerraform.init(
|
439
|
+
# from_module: 'some/module/path',
|
440
|
+
# path: 'infra/module')
|
441
|
+
#
|
442
|
+
def init(parameters = {})
|
443
|
+
exec(RubyTerraform::Commands::Init, parameters)
|
444
|
+
end
|
445
|
+
|
446
|
+
# Invokes the +terraform login+ command which retrieves an authentication
|
447
|
+
# token for the given hostname, if it supports automatic login, and saves it
|
448
|
+
# in a credentials file in your home directory.
|
449
|
+
#
|
450
|
+
# If no hostname is provided, the default hostname is app.terraform.io, to
|
451
|
+
# log in to Terraform Cloud.
|
452
|
+
#
|
453
|
+
# If not overridden by credentials helper settings in the CLI configuration,
|
454
|
+
# the credentials will be written to the following local file:
|
455
|
+
# ~/.terraform.d/credentials.tfrc.json
|
456
|
+
#
|
457
|
+
# @param parameters The parameters used to invoke the command
|
458
|
+
# @option parameters [String] :chdir The path of a working directory to
|
459
|
+
# switch to before executing the given subcommand.
|
460
|
+
#
|
461
|
+
# @example Basic Invocation
|
462
|
+
# RubyTerraform.login
|
463
|
+
#
|
464
|
+
def login(parameters = {})
|
465
|
+
exec(RubyTerraform::Commands::Login, parameters)
|
466
|
+
end
|
467
|
+
|
468
|
+
# Invokes the +terraform logout+ command which removes locally-stored
|
469
|
+
# credentials for specified hostname.
|
470
|
+
#
|
471
|
+
# Note: the API token is only removed from local storage, not destroyed on
|
472
|
+
# the remote server, so it will remain valid until manually revoked.
|
473
|
+
#
|
474
|
+
# If no hostname is provided, the default hostname is app.terraform.io.
|
475
|
+
#
|
476
|
+
# @param parameters The parameters used to invoke the command
|
477
|
+
# @option parameters [String] :chdir The path of a working directory to
|
478
|
+
# switch to before executing the given subcommand.
|
479
|
+
#
|
480
|
+
# @example Basic Invocation
|
481
|
+
# RubyTerraform.logout
|
482
|
+
#
|
483
|
+
def logout(parameters = {})
|
484
|
+
exec(RubyTerraform::Commands::Logout, parameters)
|
485
|
+
end
|
486
|
+
|
487
|
+
# Invokes the +terraform output+ command which reads an output variable from
|
488
|
+
# a Terraform state file and prints the value. With no additional arguments,
|
489
|
+
# output will display all the outputs for the root module. If +:name+ is not
|
490
|
+
# specified, all outputs are printed.
|
491
|
+
#
|
492
|
+
# @param parameters The parameters used to invoke the command
|
493
|
+
# @option parameters [String] :name The name of the output to read.
|
494
|
+
# @option parameters [String] :chdir The path of a working directory to
|
495
|
+
# switch to before executing the given subcommand.
|
496
|
+
# @option parameters [String] :state The path to the state file to read;
|
497
|
+
# defaults to +"terraform.tfstate"+.
|
498
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
499
|
+
# from the command should be in color.
|
500
|
+
# @option parameters [Boolean] :json (false) If +true+, machine readable
|
501
|
+
# output will be printed in JSON format.
|
502
|
+
# @option parameters [Boolean] :raw (false) If +true+, for value types that
|
503
|
+
# can be automatically converted to a string, will print the raw string
|
504
|
+
# directly, rather than a human-oriented representation of the value.
|
505
|
+
#
|
506
|
+
# @example Basic Invocation
|
507
|
+
# RubyTerraform.output(
|
508
|
+
# name: 'vpc_id')
|
509
|
+
#
|
510
|
+
def output(parameters = {})
|
511
|
+
exec(RubyTerraform::Commands::Output, parameters)
|
512
|
+
end
|
513
|
+
|
514
|
+
# Invokes the +terraform plan+ command which generates a speculative
|
515
|
+
# execution plan, showing what actions Terraform would take to apply the
|
516
|
+
# current configuration. This command will not actually perform the planned
|
517
|
+
# actions.
|
518
|
+
#
|
519
|
+
# You can optionally save the plan to a file, which you can then pass to
|
520
|
+
# the {#apply} command to perform exactly the actions described in the plan.
|
521
|
+
#
|
522
|
+
# @param parameters The parameters used to invoke the command
|
523
|
+
# @option parameters [String] :plan The path to output the plan if it should
|
524
|
+
# be saved to a file.
|
525
|
+
# @option parameters [String] :chdir The path of a working directory to
|
526
|
+
# switch to before executing the given subcommand.
|
527
|
+
# @option parameters [Boolean] :compact_warnings (false) When +true+, if
|
528
|
+
# terraform produces any warnings that are not accompanied by errors,
|
529
|
+
# they are shown in a more compact form that includes only the summary
|
530
|
+
# messages.
|
531
|
+
# @option parameters [Boolean] :destroy (false) When +true+, a plan will be
|
532
|
+
# generated to destroy all resources managed by the given configuration
|
533
|
+
# and state.
|
534
|
+
# @option parameters [Boolean] :detailed_exitcode (false) Whether or not to
|
535
|
+
# return detailed exit codes when the command exits; this will change the
|
536
|
+
# meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 -
|
537
|
+
# Errored; 2 - Succeeded, there is a diff.
|
538
|
+
# @option parameters [Boolean] :input (true) When +false+, will not ask for
|
539
|
+
# input for variables not directly set.
|
540
|
+
# @option parameters [Boolean] :lock (true) When +true+, locks the state
|
541
|
+
# file when locking is supported; when +false+, does not lock the state
|
542
|
+
# file.
|
543
|
+
# @option parameters [String] :lock_timeout ("0s") The duration to retry a
|
544
|
+
# state lock.
|
545
|
+
# @option parameters [Boolean] :no_color (false) Whether or not the output
|
546
|
+
# from the command should be in color.
|
547
|
+
# @option parameters [Integer] :parallelism (10) The number of parallel
|
548
|
+
# resource operations.
|
549
|
+
# @option parameters [Boolean] :refresh (true) When +true+, updates state
|
550
|
+
# prior to checking for differences; when +false+ uses locally available
|
551
|
+
# state; this has no effect when +:plan+ is provided.
|
552
|
+
# @option parameters [String] :state ("terraform.tfstate") The path to the
|
553
|
+
# state file from which to read state and in which to store state (unless
|
554
|
+
# +:state_out+ is specified).
|
555
|
+
# @option parameters [String] :target The address of a resource to target;
|
556
|
+
# if both +:target+ and +:targets+ are provided, all targets will be
|
557
|
+
# passed to terraform.
|
558
|
+
# @option parameters [Array<String>] :targets An array of resource addresses
|
559
|
+
# to target; if both +:target+ and +:targets+ are provided, all targets
|
560
|
+
# will be passed to terraform.
|
561
|
+
# @option parameters [Hash<String, Object>] :vars A map of variables to be
|
562
|
+
# passed to the terraform configuration.
|
563
|
+
# @option parameters [String] :var_file The path to a terraform var file;
|
564
|
+
# if both +:var_file+ and +:var_files+ are provided, all var files will be
|
565
|
+
# passed to terraform.
|
566
|
+
# @option parameters [Array<String>] :var_files An array of paths to
|
567
|
+
# terraform var files; if both +:var_file+ and +:var_files+ are provided,
|
568
|
+
# all var files will be passed to terraform.
|
569
|
+
#
|
570
|
+
# @example Basic Invocation
|
571
|
+
# RubyTerraform.plan(
|
572
|
+
# directory: 'infra/networking',
|
573
|
+
# vars: {
|
574
|
+
# region: 'eu-central'
|
575
|
+
# })
|
576
|
+
#
|
577
|
+
def plan(parameters = {})
|
578
|
+
exec(RubyTerraform::Commands::Plan, parameters)
|
579
|
+
end
|
580
|
+
|
581
|
+
# Invokes the +terraform providers+ command which prints out a tree of
|
582
|
+
# modules in the referenced configuration annotated with their provider
|
583
|
+
# requirements.
|
584
|
+
#
|
585
|
+
# This provides an overview of all of the provider requirements across all
|
586
|
+
# referenced modules, as an aid to understanding why particular provider
|
587
|
+
# plugins are needed and why particular versions are selected.
|
588
|
+
#
|
589
|
+
# @param parameters The parameters used to invoke the command
|
590
|
+
# @option parameters [String] :chdir The path of a working directory to
|
591
|
+
# switch to before executing the given subcommand.
|
592
|
+
#
|
593
|
+
# @example Basic Invocation
|
594
|
+
# RubyTerraform.providers
|
595
|
+
#
|
596
|
+
def providers(parameters = {})
|
597
|
+
exec(RubyTerraform::Commands::Providers, parameters)
|
598
|
+
end
|
599
|
+
|
600
|
+
# Invokes the +terraform providers lock+ command which writes out dependency
|
601
|
+
# locks for the configured providers.
|
602
|
+
#
|
603
|
+
# Normally the dependency lock file (.terraform.lock.hcl) is updated
|
604
|
+
# automatically by "terraform init", but the information available to the
|
605
|
+
# normal provider installer can be constrained when you're installing
|
606
|
+
# providers from filesystem or network mirrors, and so the generated lock
|
607
|
+
# file can end up incomplete.
|
608
|
+
#
|
609
|
+
# The "providers lock" subcommand addresses that by updating the lock file
|
610
|
+
# based on the official packages available in the origin registry, ignoring
|
611
|
+
# the currently-configured installation strategy.
|
612
|
+
#
|
613
|
+
# After this command succeeds, the lock file will contain suitable checksums
|
614
|
+
# to allow installation of the providers needed by the current configuration
|
615
|
+
# on all of the selected platforms.
|
616
|
+
#
|
617
|
+
# By default this command updates the lock file for every provider declared
|
618
|
+
# in the configuration. You can override that behavior by providing one or
|
619
|
+
# more provider source addresses on the command line.
|
620
|
+
#
|
621
|
+
# @param parameters The parameters used to invoke the command
|
622
|
+
# @option parameters [String] :providers The provider source addresses for
|
623
|
+
# which the lock file should be updated.
|
624
|
+
# @option parameters [String] :chdir The path of a working directory to
|
625
|
+
# switch to before executing the given subcommand.
|
626
|
+
# @option parameters [String] :fs_mirror If provided, consults the given
|
627
|
+
# filesystem mirror directory instead of the origin registry for each of
|
628
|
+
# the given providers; this would be necessary to generate lock file
|
629
|
+
# entries for a provider that is available only via a mirror, and not
|
630
|
+
# published in an upstream registry; in this case, the set of valid
|
631
|
+
# checksums will be limited only to what Terraform can learn from the data
|
632
|
+
# in the mirror directory.
|
633
|
+
# @option parameters [String] :net_mirror If provided, consults the given
|
634
|
+
# network mirror (given as a base URL) instead of the origin registry for
|
635
|
+
# each of the given providers; this would be necessary to generate lock
|
636
|
+
# file entries for a provider that is available only via a mirror, and not
|
637
|
+
# published in an upstream registry; in this case, the set of valid
|
638
|
+
# checksums will be limited only to what Terraform can learn from the data
|
639
|
+
# in the mirror indices.
|
640
|
+
# @option parameters [String] :platform The target platform to request
|
641
|
+
# package checksums for; by default Terraform will request package
|
642
|
+
# checksums suitable only for the platform where you run this command;
|
643
|
+
# target names consist of an operating system and a CPU architecture; for
|
644
|
+
# example, "linux_amd64" selects the Linux operating system running on an
|
645
|
+
# AMD64 or x86_64 CPU; each provider is available only for a limited set
|
646
|
+
# of target platforms; if both +:platform+ and +:platforms+ are provided,
|
647
|
+
# all platforms will be passed to Terraform.
|
648
|
+
# @option parameters [Array<String>] :platforms An array of target platforms
|
649
|
+
# to request package checksums for; see +:platform+ for more details; if
|
650
|
+
# both +:platform+ and +:platforms+ are provided, all platforms will be
|
651
|
+
# passed to Terraform.
|
652
|
+
#
|
653
|
+
# @example Basic Invocation
|
654
|
+
# RubyTerraform.providers_lock(
|
655
|
+
# fs_mirror: "/usr/local/terraform/providers",
|
656
|
+
# platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"],
|
657
|
+
# providers: "tf.example.com/ourcompany/ourplatform")
|
658
|
+
#
|
659
|
+
def providers_lock(parameters = {})
|
660
|
+
exec(RubyTerraform::Commands::ProvidersLock, parameters)
|
661
|
+
end
|
662
|
+
|
663
|
+
# Invokes the +terraform providers mirror+ command which saves local copies
|
664
|
+
# of all required provider plugins.
|
665
|
+
#
|
666
|
+
# Populates a local directory with copies of the provider plugins needed for
|
667
|
+
# the current configuration, so that the directory can be used either
|
668
|
+
# directly as a filesystem mirror or as the basis for a network mirror and
|
669
|
+
# thus obtain those providers without access to their origin registries in
|
670
|
+
# future.
|
671
|
+
#
|
672
|
+
# The mirror directory will contain JSON index files that can be published
|
673
|
+
# along with the mirrored packages on a static HTTP file server to produce a
|
674
|
+
# network mirror. Those index files will be ignored if the directory is used
|
675
|
+
# instead as a local filesystem mirror.
|
676
|
+
#
|
677
|
+
# @param parameters The parameters used to invoke the command
|
678
|
+
# @option parameters [String] :directory The directory to populate with the
|
679
|
+
# mirrored provider plugins.
|
680
|
+
# @option parameters [String] :chdir The path of a working directory to
|
681
|
+
# switch to before executing the given subcommand.
|
682
|
+
# @option parameters [String] :platform The target platform to build a
|
683
|
+
# mirror for; by default Terraform will obtain plugin packages suitable
|
684
|
+
# for the platform where you run this command; target names consist of an
|
685
|
+
# operating system and a CPU architecture; for example, "linux_amd64"
|
686
|
+
# selects the Linux operating system running on an AMD64 or x86_64 CPU;
|
687
|
+
# each provider is available only for a limited set of target platforms;
|
688
|
+
# if both +:platform+ and +:platforms+ are provided, all platforms will be
|
689
|
+
# passed to Terraform.
|
690
|
+
# @option parameters [Array<String>] :platforms An array of target platforms
|
691
|
+
# to build a mirror for for; see +:platform+ for more details; if both
|
692
|
+
# +:platform+ and +:platforms+ are provided, all platforms will be passed
|
693
|
+
# to Terraform.
|
694
|
+
#
|
695
|
+
# @example Basic Invocation
|
696
|
+
# RubyTerraform.platforms_mirror(
|
697
|
+
# directory: './plugins',
|
698
|
+
# platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"])
|
699
|
+
#
|
700
|
+
def providers_mirror(parameters = {})
|
701
|
+
exec(RubyTerraform::Commands::ProvidersMirror, parameters)
|
702
|
+
end
|
703
|
+
|
100
704
|
{
|
101
705
|
clean: RubyTerraform::Commands::Clean,
|
102
|
-
destroy: RubyTerraform::Commands::Destroy,
|
103
|
-
format: RubyTerraform::Commands::Format,
|
104
|
-
force_unlock: RubyTerraform::Commands::ForceUnlock,
|
105
|
-
get: RubyTerraform::Commands::Get,
|
106
|
-
graph: RubyTerraform::Commands::Graph,
|
107
|
-
import: RubyTerraform::Commands::Import,
|
108
|
-
init: RubyTerraform::Commands::Init,
|
109
|
-
login: RubyTerraform::Commands::Login,
|
110
|
-
logout: RubyTerraform::Commands::Logout,
|
111
|
-
output: RubyTerraform::Commands::Output,
|
112
|
-
plan: RubyTerraform::Commands::Plan,
|
113
|
-
providers: RubyTerraform::Commands::Providers,
|
114
|
-
providers_lock: RubyTerraform::Commands::ProvidersLock,
|
115
|
-
providers_mirror: RubyTerraform::Commands::ProvidersMirror,
|
116
706
|
providers_schema: RubyTerraform::Commands::ProvidersSchema,
|
117
707
|
refresh: RubyTerraform::Commands::Refresh,
|
118
708
|
remote_config: RubyTerraform::Commands::RemoteConfig,
|