ruby-terraform 0.65.0.pre.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -17
- data/README.md +148 -414
- data/Rakefile +25 -0
- data/lib/ruby_terraform.rb +1365 -41
- data/lib/ruby_terraform/commands.rb +0 -2
- data/lib/ruby_terraform/commands/apply.rb +78 -4
- data/lib/ruby_terraform/commands/base.rb +13 -2
- data/lib/ruby_terraform/commands/destroy.rb +71 -4
- data/lib/ruby_terraform/commands/force_unlock.rb +33 -3
- data/lib/ruby_terraform/commands/format.rb +45 -2
- data/lib/ruby_terraform/commands/get.rb +35 -2
- data/lib/ruby_terraform/commands/graph.rb +48 -2
- data/lib/ruby_terraform/commands/import.rb +98 -3
- data/lib/ruby_terraform/commands/init.rb +84 -3
- data/lib/ruby_terraform/commands/login.rb +26 -2
- data/lib/ruby_terraform/commands/logout.rb +23 -2
- data/lib/ruby_terraform/commands/output.rb +34 -2
- data/lib/ruby_terraform/commands/plan.rb +72 -3
- data/lib/ruby_terraform/commands/providers.rb +30 -2
- data/lib/ruby_terraform/commands/providers_lock.rb +72 -3
- data/lib/ruby_terraform/commands/providers_mirror.rb +44 -2
- data/lib/ruby_terraform/commands/providers_schema.rb +21 -2
- data/lib/ruby_terraform/commands/refresh.rb +70 -3
- data/lib/ruby_terraform/commands/show.rb +26 -3
- data/lib/ruby_terraform/commands/state_list.rb +54 -3
- data/lib/ruby_terraform/commands/state_move.rb +64 -6
- data/lib/ruby_terraform/commands/state_pull.rb +24 -2
- data/lib/ruby_terraform/commands/state_push.rb +49 -3
- data/lib/ruby_terraform/commands/state_remove.rb +55 -7
- data/lib/ruby_terraform/commands/state_replace_provider.rb +39 -6
- data/lib/ruby_terraform/commands/state_show.rb +26 -2
- data/lib/ruby_terraform/commands/taint.rb +63 -2
- data/lib/ruby_terraform/commands/untaint.rb +55 -2
- data/lib/ruby_terraform/commands/validate.rb +51 -6
- data/lib/ruby_terraform/commands/workspace_delete.rb +29 -7
- data/lib/ruby_terraform/commands/workspace_list.rb +21 -6
- data/lib/ruby_terraform/commands/workspace_new.rb +28 -7
- data/lib/ruby_terraform/commands/workspace_select.rb +23 -7
- data/lib/ruby_terraform/commands/workspace_show.rb +17 -2
- data/lib/ruby_terraform/options.rb +1 -1
- data/lib/ruby_terraform/options/definition.rb +6 -2
- data/lib/ruby_terraform/options/definitions.rb +12 -3
- data/lib/ruby_terraform/options/{common.rb → global.rb} +2 -1
- data/lib/ruby_terraform/options/types.rb +0 -1
- data/lib/ruby_terraform/options/types/flag.rb +8 -4
- data/lib/ruby_terraform/options/types/standard.rb +20 -6
- data/lib/ruby_terraform/version.rb +1 -1
- data/ruby_terraform.gemspec +3 -2
- metadata +25 -14
- data/lib/ruby_terraform/commands/clean.rb +0 -26
- data/lib/ruby_terraform/commands/remote_config.rb +0 -25
- data/lib/ruby_terraform/options/types/base.rb +0 -19
@@ -1,18 +1,83 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform plan+ command which generates a speculative execution
|
9
|
+
# plan, showing what actions Terraform would take to apply the current
|
10
|
+
# configuration. This command will not actually perform the planned actions.
|
11
|
+
#
|
12
|
+
# You can optionally save the plan to a file, which you can then pass to
|
13
|
+
# the {Apply} command to perform exactly the actions described in the plan.
|
14
|
+
#
|
15
|
+
# For options accepted on construction, see {#initialize}.
|
16
|
+
#
|
17
|
+
# When executing an instance of {Plan} via {#execute}, the following
|
18
|
+
# options are supported:
|
19
|
+
#
|
20
|
+
# * +:directory+: the path to a directory containing terraform
|
21
|
+
# configuration (deprecated in terraform 0.14, removed in terraform 0.15,
|
22
|
+
# use +:chdir+ instead).
|
23
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
24
|
+
# the given subcommand.
|
25
|
+
# * +:compact_warnings+: when +true+, if terraform produces any warnings
|
26
|
+
# that are not accompanied by errors, they are shown in a more compact
|
27
|
+
# form that includes only the summary messages; defaults to +false+.
|
28
|
+
# * +:destroy+: when +true+, a plan will be generated to destroy all
|
29
|
+
# resources managed by the given configuration and state; defaults to
|
30
|
+
# +false+.
|
31
|
+
# * +:detailed_exitcode+: whether or not to return detailed exit codes when
|
32
|
+
# the command exits; this will change the meaning of exit codes to:
|
33
|
+
# 0 - Succeeded, diff is empty (no changes); 1 - Errored; 2 - Succeeded,
|
34
|
+
# there is a diff; defaults to +false+.
|
35
|
+
# * +:input+: when +false+, will not ask for input for variables not
|
36
|
+
# directly set; defaults to +true+.
|
37
|
+
# * +:lock+: when +true+, locks the state file when locking is supported;
|
38
|
+
# when +false+, does not lock the state file; defaults to +true+.
|
39
|
+
# * +:lock_timeout+: the duration to retry a state lock; defaults to +"0s"+.
|
40
|
+
# * +:no_color+: whether or not the output from the command should be in
|
41
|
+
# color; defaults to +false+.
|
42
|
+
# * +:parallelism+: the number of parallel resource operations; defaults to
|
43
|
+
# +10+.
|
44
|
+
# * +:plan+: the path to output the plan if it should be saved to a file.
|
45
|
+
# * +:refresh+: when +true+, updates state prior to checking for
|
46
|
+
# differences; when +false+ uses locally available state; defaults to
|
47
|
+
# +true+; this has no effect when +:plan+ is provided.
|
48
|
+
# * +:state+: the path to the state file from which to read state and in
|
49
|
+
# which to store state (unless +:state_out+ is specified); defaults to
|
50
|
+
# +"terraform.tfstate"+.
|
51
|
+
# * +:target+: the address of a resource to target; if both +:target+ and
|
52
|
+
# +:targets+ are provided, all targets will be passed to terraform.
|
53
|
+
# * +:targets+: an array of resource addresses to target; if both +:target+
|
54
|
+
# and +:targets+ are provided, all targets will be passed to terraform.
|
55
|
+
# * +:vars+: a map of variables to be passed to the terraform configuration.
|
56
|
+
# * +:var_file+: the path to a terraform var file; if both +:var_file+ and
|
57
|
+
# +:var_files+ are provided, all var files will be passed to terraform.
|
58
|
+
# * +:var_files+: an array of paths to terraform var files; if both
|
59
|
+
# +:var_file+ and +:var_files+ are provided, all var files will be passed
|
60
|
+
# to terraform.
|
61
|
+
#
|
62
|
+
# @example Basic Invocation
|
63
|
+
# RubyTerraform::Commands::Plan.new.execute(
|
64
|
+
# directory: 'infra/networking',
|
65
|
+
# vars: {
|
66
|
+
# region: 'eu-central'
|
67
|
+
# })
|
68
|
+
#
|
8
69
|
class Plan < Base
|
9
|
-
include RubyTerraform::Options::
|
70
|
+
include RubyTerraform::Options::Global
|
10
71
|
|
72
|
+
# @!visibility private
|
11
73
|
def subcommands
|
12
74
|
%w[plan]
|
13
75
|
end
|
14
76
|
|
15
|
-
|
77
|
+
# rubocop:disable Metrics/MethodLength
|
78
|
+
|
79
|
+
# @!visibility private
|
80
|
+
def options
|
16
81
|
%w[
|
17
82
|
-compact-warnings
|
18
83
|
-destroy
|
@@ -31,10 +96,14 @@ module RubyTerraform
|
|
31
96
|
] + super
|
32
97
|
end
|
33
98
|
|
99
|
+
# rubocop:enable Metrics/MethodLength
|
100
|
+
|
101
|
+
# @!visibility private
|
34
102
|
def arguments(parameters)
|
35
103
|
[parameters[:directory]]
|
36
104
|
end
|
37
105
|
|
106
|
+
# @!visibility private
|
38
107
|
def parameter_defaults(_parameters)
|
39
108
|
{ vars: {}, var_files: [], targets: [] }
|
40
109
|
end
|
@@ -1,16 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform providers+ command which prints out a tree of modules
|
9
|
+
# in the referenced configuration annotated with their provider
|
10
|
+
# requirements.
|
11
|
+
#
|
12
|
+
# This provides an overview of all of the provider requirements across all
|
13
|
+
# referenced modules, as an aid to understanding why particular provider
|
14
|
+
# plugins are needed and why particular versions are selected.
|
15
|
+
#
|
16
|
+
# For options accepted on construction, see {#initialize}.
|
17
|
+
#
|
18
|
+
# When executing an instance of {Plan} via {#execute}, the following
|
19
|
+
# options are supported:
|
20
|
+
#
|
21
|
+
# * +:directory+: the path to a directory containing terraform
|
22
|
+
# configuration (deprecated in terraform 0.14, removed in terraform 0.15,
|
23
|
+
# use +:chdir+ instead).
|
24
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
25
|
+
# the given subcommand.
|
26
|
+
#
|
27
|
+
# @example Basic Invocation
|
28
|
+
# RubyTerraform::Commands::Providers.new.execute
|
29
|
+
#
|
8
30
|
class Providers < Base
|
9
|
-
include RubyTerraform::Options::
|
31
|
+
include RubyTerraform::Options::Global
|
10
32
|
|
33
|
+
# @!visibility private
|
11
34
|
def subcommands
|
12
35
|
%w[providers]
|
13
36
|
end
|
37
|
+
|
38
|
+
# @!visibility private
|
39
|
+
def arguments(parameters)
|
40
|
+
[parameters[:directory]]
|
41
|
+
end
|
14
42
|
end
|
15
43
|
end
|
16
44
|
end
|
@@ -1,17 +1,85 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform providers lock+ command which writes out dependency
|
9
|
+
# locks for the configured providers.
|
10
|
+
#
|
11
|
+
# Normally the dependency lock file (.terraform.lock.hcl) is updated
|
12
|
+
# automatically by "terraform init", but the information available to the
|
13
|
+
# normal provider installer can be constrained when you're installing
|
14
|
+
# providers from filesystem or network mirrors, and so the generated lock
|
15
|
+
# file can end up incomplete.
|
16
|
+
#
|
17
|
+
# The "providers lock" subcommand addresses that by updating the lock file
|
18
|
+
# based on the official packages available in the origin registry, ignoring
|
19
|
+
# the currently-configured installation strategy.
|
20
|
+
#
|
21
|
+
# After this command succeeds, the lock file will contain suitable checksums
|
22
|
+
# to allow installation of the providers needed by the current configuration
|
23
|
+
# on all of the selected platforms.
|
24
|
+
#
|
25
|
+
# By default this command updates the lock file for every provider declared
|
26
|
+
# in the configuration. You can override that behavior by providing one or
|
27
|
+
# more provider source addresses on the command line.
|
28
|
+
#
|
29
|
+
# For options accepted on construction, see {#initialize}.
|
30
|
+
#
|
31
|
+
# When executing an instance of {ProvidersLock} via {#execute}, the
|
32
|
+
# following options are supported:
|
33
|
+
#
|
34
|
+
# * +:provider+: the provider source address for which the lock file
|
35
|
+
# should be updated; if both +:provider+ and +:providers+ are provided,
|
36
|
+
# all providers will be passed to Terraform.
|
37
|
+
# * +:providers+: an array of provider source addresses for which the lock
|
38
|
+
# file should be updated; if both +:provider+ and +:providers+ are
|
39
|
+
# provided, all providers will be passed to Terraform.
|
40
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
41
|
+
# the given subcommand.
|
42
|
+
# * +:fs_mirror+: if provided, consults the given filesystem mirror
|
43
|
+
# directory instead of the origin registry for each of the given
|
44
|
+
# providers; this would be necessary to generate lock file entries for
|
45
|
+
# a provider that is available only via a mirror, and not published in an
|
46
|
+
# upstream registry; in this case, the set of valid checksums will be
|
47
|
+
# limited only to what Terraform can learn from the data in the mirror
|
48
|
+
# directory.
|
49
|
+
# * +:net_mirror+: if provided, consults the given network mirror (given as
|
50
|
+
# a base URL) instead of the origin registry for each of the given
|
51
|
+
# providers; this would be necessary to generate lock file entries for a
|
52
|
+
# provider that is available only via a mirror, and not published in an
|
53
|
+
# upstream registry; in this case, the set of valid checksums will be
|
54
|
+
# limited only to what Terraform can learn from the data in the mirror
|
55
|
+
# indices.
|
56
|
+
# * +:platform+: the target platform to request package checksums for; by
|
57
|
+
# default Terraform will request package checksums suitable only for the
|
58
|
+
# platform where you run this command; target names consist of an
|
59
|
+
# operating system and a CPU architecture; for example, "linux_amd64"
|
60
|
+
# selects the Linux operating system running on an AMD64 or x86_64 CPU;
|
61
|
+
# each provider is available only for a limited set of target platforms;
|
62
|
+
# if both +:platform+ and +:platforms+ are provided, all platforms will be
|
63
|
+
# passed to Terraform.
|
64
|
+
# * +:platforms+: an array of target platforms to request package checksums
|
65
|
+
# for; see +:platform+ for more details; if both +:platform+ and
|
66
|
+
# +:platforms+ are provided, all platforms will be passed to Terraform.
|
67
|
+
#
|
68
|
+
# @example Basic Invocation
|
69
|
+
# RubyTerraform::Commands::ProvidersLock.new.execute(
|
70
|
+
# fs_mirror: "/usr/local/terraform/providers",
|
71
|
+
# platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"],
|
72
|
+
# provider: "tf.example.com/ourcompany/ourplatform")
|
73
|
+
#
|
8
74
|
class ProvidersLock < Base
|
9
|
-
include RubyTerraform::Options::
|
75
|
+
include RubyTerraform::Options::Global
|
10
76
|
|
77
|
+
# @!visibility private
|
11
78
|
def subcommands
|
12
79
|
%w[providers lock]
|
13
80
|
end
|
14
81
|
|
82
|
+
# @!visibility private
|
15
83
|
def options
|
16
84
|
%w[
|
17
85
|
-fs-mirror
|
@@ -20,8 +88,9 @@ module RubyTerraform
|
|
20
88
|
] + super
|
21
89
|
end
|
22
90
|
|
91
|
+
# @!visibility private
|
23
92
|
def arguments(parameters)
|
24
|
-
[parameters[:providers]]
|
93
|
+
[parameters[:provider], parameters[:providers]]
|
25
94
|
end
|
26
95
|
end
|
27
96
|
end
|
@@ -1,21 +1,63 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform providers mirror+ command which saves local copies of
|
9
|
+
# all required provider plugins.
|
10
|
+
#
|
11
|
+
# Populates a local directory with copies of the provider plugins needed for
|
12
|
+
# the current configuration, so that the directory can be used either
|
13
|
+
# directly as a filesystem mirror or as the basis for a network mirror and
|
14
|
+
# thus obtain those providers without access to their origin registries in
|
15
|
+
# future.
|
16
|
+
#
|
17
|
+
# The mirror directory will contain JSON index files that can be published
|
18
|
+
# along with the mirrored packages on a static HTTP file server to produce a
|
19
|
+
# network mirror. Those index files will be ignored if the directory is used
|
20
|
+
# instead as a local filesystem mirror.
|
21
|
+
#
|
22
|
+
# For options accepted on construction, see {#initialize}.
|
23
|
+
#
|
24
|
+
# When executing an instance of {ProvidersMirror} via {#execute}, the
|
25
|
+
# following options are supported:
|
26
|
+
#
|
27
|
+
# * +:directory+: the directory to populate with the mirrored provider
|
28
|
+
# plugins.
|
29
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
30
|
+
# the given subcommand.
|
31
|
+
# * +:platform+: the target platform to build a mirror for; by default
|
32
|
+
# Terraform will obtain plugin packages suitable for the platform where
|
33
|
+
# you run this command; target names consist of an operating system and a
|
34
|
+
# CPU architecture; for example, "linux_amd64" selects the Linux operating
|
35
|
+
# system running on an AMD64 or x86_64 CPU; each provider is available
|
36
|
+
# only for a limited set of target platforms; if both +:platform+ and
|
37
|
+
# +:platforms+ are provided, all platforms will be passed to Terraform.
|
38
|
+
# * +:platforms+: an array of target platforms to build a mirror for for;
|
39
|
+
# see +:platform+ for more details; if both +:platform+ and +:platforms+
|
40
|
+
# are provided, all platforms will be passed to Terraform.
|
41
|
+
#
|
42
|
+
# @example Basic Invocation
|
43
|
+
# RubyTerraform::Commands::ProvidersMirror.new.execute(
|
44
|
+
# directory: './plugins',
|
45
|
+
# platforms: ["windows_amd64", "darwin_amd64", "linux_amd64"])
|
46
|
+
#
|
8
47
|
class ProvidersMirror < Base
|
9
|
-
include RubyTerraform::Options::
|
48
|
+
include RubyTerraform::Options::Global
|
10
49
|
|
50
|
+
# @!visibility private
|
11
51
|
def subcommands
|
12
52
|
%w[providers mirror]
|
13
53
|
end
|
14
54
|
|
55
|
+
# @!visibility private
|
15
56
|
def options
|
16
57
|
%w[-platform] + super
|
17
58
|
end
|
18
59
|
|
60
|
+
# @!visibility private
|
19
61
|
def arguments(parameters)
|
20
62
|
[parameters[:directory]]
|
21
63
|
end
|
@@ -1,21 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform providers schema+ command which prints out a json
|
9
|
+
# representation of the schemas for all providers used in the current
|
10
|
+
# configuration.
|
11
|
+
#
|
12
|
+
# For options accepted on construction, see {#initialize}.
|
13
|
+
#
|
14
|
+
# When executing an instance of {ProvidersSchema} via {#execute}, the
|
15
|
+
# following options are supported:
|
16
|
+
#
|
17
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
18
|
+
# the given subcommand.
|
19
|
+
#
|
20
|
+
# @example Basic Invocation
|
21
|
+
# RubyTerraform::Commands::ProvidersSchema.new.execute(
|
22
|
+
# directory: 'infra/networking')
|
23
|
+
#
|
8
24
|
class ProvidersSchema < Base
|
9
|
-
include RubyTerraform::Options::
|
25
|
+
include RubyTerraform::Options::Global
|
10
26
|
|
27
|
+
# @!visibility private
|
11
28
|
def subcommands
|
12
29
|
%w[providers schema]
|
13
30
|
end
|
14
31
|
|
32
|
+
# @!visibility private
|
15
33
|
def options
|
16
34
|
%w[-json] + super
|
17
35
|
end
|
18
36
|
|
37
|
+
# @!visibility private
|
19
38
|
def parameter_overrides(_parameters)
|
20
39
|
# Terraform 0.15 - at this time, the -json flag is a required option.
|
21
40
|
{ json: true }
|
@@ -1,18 +1,80 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'base'
|
4
|
-
require_relative '../options/
|
4
|
+
require_relative '../options/global'
|
5
5
|
|
6
6
|
module RubyTerraform
|
7
7
|
module Commands
|
8
|
+
# Wraps the +terraform refresh+ command which updates the state file of your
|
9
|
+
# infrastructure with metadata that matches the physical resources they are
|
10
|
+
# tracking.
|
11
|
+
#
|
12
|
+
# This will not modify your infrastructure, but it can modify your state
|
13
|
+
# file to update metadata. This metadata might cause new changes to occur
|
14
|
+
# when you generate a plan or call apply next.
|
15
|
+
#
|
16
|
+
# For options accepted on construction, see {#initialize}.
|
17
|
+
#
|
18
|
+
# When executing an instance of {Refresh} via {#execute}, the following
|
19
|
+
# options are supported:
|
20
|
+
#
|
21
|
+
# * +:directory+: the path to a directory containing terraform configuration
|
22
|
+
# (deprecated in terraform 0.14, removed in terraform 0.15, use +:chdir+
|
23
|
+
# instead).
|
24
|
+
# * +:chdir+: the path of a working directory to switch to before executing
|
25
|
+
# the given subcommand.
|
26
|
+
# * +:backup+: the path to backup the existing state file before modifying;
|
27
|
+
# defaults to the +:state_out+ path with +".backup"+ extension; set
|
28
|
+
# +:no_backup+ to +true+ to skip backups entirely (legacy).
|
29
|
+
# * +:compact_warnings+: when +true+, if terraform produces any warnings
|
30
|
+
# that are not accompanied by errors, they are shown in a more compact
|
31
|
+
# form that includes only the summary messages; defaults to +false+.
|
32
|
+
# * +:input+: when +false+, will not ask for input for variables not
|
33
|
+
# directly set; defaults to +true+.
|
34
|
+
# * +:lock+: when +true+, locks the state file when locking is supported;
|
35
|
+
# when +false+, does not lock the state file; defaults to +true+.
|
36
|
+
# * +:lock_timeout+: the duration to retry a state lock; defaults to +"0s"+.
|
37
|
+
# * +:no_backup+: when +true+, no backup file will be written; defaults to
|
38
|
+
# +false+ (legacy).
|
39
|
+
# * +:no_color+: whether or not the output from the command should be in
|
40
|
+
# color; defaults to +false+.
|
41
|
+
# * +:parallelism+: the number of parallel resource operations; defaults to
|
42
|
+
# +10+.
|
43
|
+
# * +:state+: the path to the state file from which to read state and in
|
44
|
+
# which to store state (unless +:state_out+ is specified); defaults to
|
45
|
+
# +"terraform.tfstate"+ (legacy).
|
46
|
+
# * +:state_out+: the path to write state to that is different than
|
47
|
+
# +:state+; this can be used to preserve the old state (legacy).
|
48
|
+
# * +:target+: the address of a resource to target; if both +:target+ and
|
49
|
+
# +:targets+ are provided, all targets will be passed to terraform.
|
50
|
+
# * +:targets+: an array of resource addresses to target; if both +:target+
|
51
|
+
# and +:targets+ are provided, all targets will be passed to terraform.
|
52
|
+
# * +:vars+: a map of variables to be passed to the terraform configuration.
|
53
|
+
# * +:var_file+: the path to a terraform var file; if both +:var_file+ and
|
54
|
+
# +:var_files+ are provided, all var files will be passed to terraform.
|
55
|
+
# * +:var_files+: an array of paths to terraform var files; if both
|
56
|
+
# +:var_file+ and +:var_files+ are provided, all var files will be passed
|
57
|
+
# to terraform.
|
58
|
+
#
|
59
|
+
# @example Basic Invocation
|
60
|
+
# RubyTerraform::Commands::Refresh.new.execute(
|
61
|
+
# directory: 'infra/networking',
|
62
|
+
# vars: {
|
63
|
+
# region: 'eu-central'
|
64
|
+
# })
|
65
|
+
#
|
8
66
|
class Refresh < Base
|
9
|
-
include RubyTerraform::Options::
|
67
|
+
include RubyTerraform::Options::Global
|
10
68
|
|
69
|
+
# @!visibility private
|
11
70
|
def subcommands
|
12
71
|
%w[refresh]
|
13
72
|
end
|
14
73
|
|
15
|
-
|
74
|
+
# rubocop:disable Metrics/MethodLength
|
75
|
+
|
76
|
+
# @!visibility private
|
77
|
+
def options
|
16
78
|
%w[
|
17
79
|
-backup
|
18
80
|
-compact-warnings
|
@@ -29,14 +91,19 @@ module RubyTerraform
|
|
29
91
|
] + super
|
30
92
|
end
|
31
93
|
|
94
|
+
# rubocop:enable Metrics/MethodLength
|
95
|
+
|
96
|
+
# @!visibility private
|
32
97
|
def arguments(parameters)
|
33
98
|
[parameters[:directory]]
|
34
99
|
end
|
35
100
|
|
101
|
+
# @!visibility private
|
36
102
|
def parameter_defaults(_parameters)
|
37
103
|
{ vars: {}, var_files: [], targets: [] }
|
38
104
|
end
|
39
105
|
|
106
|
+
# @!visibility private
|
40
107
|
def parameter_overrides(parameters)
|
41
108
|
{ backup: parameters[:no_backup] ? '-' : parameters[:backup] }
|
42
109
|
end
|