kitchen-terraform 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -1
- data/README.md +33 -359
- data/lib/kitchen/driver/terraform.rb +273 -57
- data/lib/kitchen/driver/terraform/verify_client_version.rb +44 -0
- data/lib/kitchen/driver/terraform/workflow.rb +90 -0
- data/lib/kitchen/provisioner/terraform.rb +31 -37
- data/lib/{terraform/get_command.rb → kitchen/terraform.rb} +3 -5
- data/lib/{terraform/deprecated_version.rb → kitchen/terraform/client.rb} +5 -12
- data/lib/kitchen/terraform/client/apply.rb +38 -0
- data/lib/kitchen/terraform/client/execute_command.rb +56 -0
- data/lib/kitchen/terraform/client/get.rb +35 -0
- data/lib/kitchen/terraform/client/output.rb +50 -0
- data/lib/kitchen/terraform/client/plan.rb +42 -0
- data/lib/kitchen/terraform/client/process_options.rb +87 -0
- data/lib/kitchen/terraform/client/validate.rb +35 -0
- data/lib/kitchen/terraform/client/version.rb +48 -0
- data/lib/{terraform/apply_timeout_config.rb → kitchen/terraform/create_directories.rb} +18 -11
- data/lib/kitchen/terraform/define_config_attribute.rb +39 -0
- data/lib/kitchen/terraform/define_integer_config_attribute.rb +43 -0
- data/lib/kitchen/terraform/define_string_config_attribute.rb +43 -0
- data/lib/kitchen/verifier/terraform.rb +186 -38
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_attributes.rb +93 -0
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_backend.rb +32 -0
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_controls.rb +39 -0
- data/lib/{terraform/apply_command.rb → kitchen/verifier/terraform/configure_inspec_runner_host.rb} +11 -15
- data/lib/{terraform/deprecated_output_parser.rb → kitchen/verifier/terraform/configure_inspec_runner_port.rb} +16 -20
- data/lib/{terraform/deprecated_variables_coercer.rb → kitchen/verifier/terraform/configure_inspec_runner_user.rb} +16 -14
- data/lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb +67 -0
- data/lib/{terraform/version_command.rb → terraform.rb} +1 -5
- data/lib/terraform/configurable.rb +18 -61
- data/lib/terraform/debug_logger.rb +12 -12
- data/lib/terraform/project_version.rb +1 -1
- metadata +72 -135
- metadata.gz.sig +0 -0
- data/lib/terraform/cli_config.rb +0 -29
- data/lib/terraform/client.rb +0 -96
- data/lib/terraform/color_coercer.rb +0 -35
- data/lib/terraform/color_config.rb +0 -32
- data/lib/terraform/command.rb +0 -53
- data/lib/terraform/command_factory.rb +0 -111
- data/lib/terraform/command_option.rb +0 -65
- data/lib/terraform/command_options.rb +0 -103
- data/lib/terraform/destructive_plan_command.rb +0 -35
- data/lib/terraform/directory_config.rb +0 -32
- data/lib/terraform/file_configs.rb +0 -36
- data/lib/terraform/group.rb +0 -61
- data/lib/terraform/group_attributes.rb +0 -42
- data/lib/terraform/group_hostnames.rb +0 -38
- data/lib/terraform/groups_coercer.rb +0 -43
- data/lib/terraform/groups_config.rb +0 -32
- data/lib/terraform/integer_coercer.rb +0 -37
- data/lib/terraform/no_output_parser.rb +0 -28
- data/lib/terraform/output_command.rb +0 -23
- data/lib/terraform/output_parser.rb +0 -55
- data/lib/terraform/parallelism_config.rb +0 -32
- data/lib/terraform/pathname_coercer.rb +0 -40
- data/lib/terraform/plan_command.rb +0 -30
- data/lib/terraform/prepare_input_file.rb +0 -34
- data/lib/terraform/prepare_output_file.rb +0 -36
- data/lib/terraform/shell_out.rb +0 -59
- data/lib/terraform/show_command.rb +0 -30
- data/lib/terraform/simple_coercer.rb +0 -36
- data/lib/terraform/simple_config.rb +0 -28
- data/lib/terraform/unsupported_version.rb +0 -26
- data/lib/terraform/validate_command.rb +0 -23
- data/lib/terraform/variable_files_coercer.rb +0 -40
- data/lib/terraform/variable_files_config.rb +0 -32
- data/lib/terraform/variables_coercer.rb +0 -49
- data/lib/terraform/variables_config.rb +0 -32
- data/lib/terraform/version.rb +0 -73
metadata.gz.sig
CHANGED
Binary file
|
data/lib/terraform/cli_config.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'ptools'
|
18
|
-
|
19
|
-
module Terraform
|
20
|
-
# Behaviour for the [:cli] config option
|
21
|
-
module CLIConfig
|
22
|
-
def self.extended(configurable_class)
|
23
|
-
configurable_class.required_config :cli do |key, value, configurable|
|
24
|
-
configurable[key] = ::File.expand_path value
|
25
|
-
end
|
26
|
-
configurable_class.default_config(:cli) { ::File.which 'terraform' }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/terraform/client.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/command_factory'
|
18
|
-
require 'terraform/no_output_parser'
|
19
|
-
require 'terraform/output_parser'
|
20
|
-
require 'terraform/shell_out'
|
21
|
-
require 'terraform/version'
|
22
|
-
|
23
|
-
module Terraform
|
24
|
-
# Client to execute commands
|
25
|
-
class Client
|
26
|
-
def apply_constructively
|
27
|
-
apply plan_command: factory.plan_command
|
28
|
-
end
|
29
|
-
|
30
|
-
def apply_destructively
|
31
|
-
apply plan_command: factory.destructive_plan_command
|
32
|
-
end
|
33
|
-
|
34
|
-
def each_output_name(&block)
|
35
|
-
output_parser(name: '').each_name(&block)
|
36
|
-
end
|
37
|
-
|
38
|
-
def iterate_output(name:, &block)
|
39
|
-
output_parser(name: name).iterate_parsed_output(&block)
|
40
|
-
end
|
41
|
-
|
42
|
-
def load_state(&block)
|
43
|
-
execute(command: factory.show_command) do |state|
|
44
|
-
/\w+/.match state, &block
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def output(name:)
|
49
|
-
output_parser(name: name).parsed_output
|
50
|
-
end
|
51
|
-
|
52
|
-
def version
|
53
|
-
execute command: factory.version_command do |value|
|
54
|
-
return ::Terraform::Version.create value: value
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
attr_accessor :apply_timeout, :cli, :factory, :logger
|
61
|
-
|
62
|
-
def apply(plan_command:)
|
63
|
-
execute command: factory.validate_command
|
64
|
-
execute command: factory.get_command
|
65
|
-
execute command: plan_command
|
66
|
-
::Terraform::ShellOut.new(
|
67
|
-
cli: cli, command: factory.apply_command, logger: logger,
|
68
|
-
timeout: apply_timeout
|
69
|
-
).execute
|
70
|
-
end
|
71
|
-
|
72
|
-
def execute(command:, &block)
|
73
|
-
::Terraform::ShellOut
|
74
|
-
.new(cli: cli, command: command, logger: logger).execute(&block)
|
75
|
-
end
|
76
|
-
|
77
|
-
def initialize(config: {}, logger:)
|
78
|
-
self.apply_timeout = config[:apply_timeout]
|
79
|
-
self.cli = config[:cli]
|
80
|
-
self.factory = ::Terraform::CommandFactory.new config: config
|
81
|
-
self.logger = logger
|
82
|
-
end
|
83
|
-
|
84
|
-
def output_parser(name:)
|
85
|
-
execute(
|
86
|
-
command: factory.output_command(target: name, version: version)
|
87
|
-
) do |value|
|
88
|
-
return ::Terraform::OutputParser.create output: value, version: version
|
89
|
-
end
|
90
|
-
rescue ::Kitchen::StandardError => exception
|
91
|
-
raise exception unless exception.message =~ /no outputs/
|
92
|
-
|
93
|
-
::Terraform::NoOutputParser.new
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
module Terraform
|
18
|
-
# A coercer for the [:color] value
|
19
|
-
class ColorCoercer
|
20
|
-
def coerce(attr:, value:)
|
21
|
-
configurable[attr] = [true, false].find(
|
22
|
-
proc { configurable.config_error attr: attr, expected: 'a boolean' },
|
23
|
-
&value.method(:==)
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
attr_accessor :configurable
|
30
|
-
|
31
|
-
def initialize(configurable:)
|
32
|
-
self.configurable = configurable
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require_relative 'color_coercer'
|
18
|
-
require_relative 'simple_config'
|
19
|
-
|
20
|
-
module Terraform
|
21
|
-
# Behaviour for the [:color] config option
|
22
|
-
module ColorConfig
|
23
|
-
include ::Terraform::SimpleConfig
|
24
|
-
|
25
|
-
def self.extended(configurable_class)
|
26
|
-
configurable_class
|
27
|
-
.configure_required attr: :color,
|
28
|
-
coercer_class: ::Terraform::ColorCoercer,
|
29
|
-
default_value: true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
data/lib/terraform/command.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/command_options'
|
18
|
-
|
19
|
-
module Terraform
|
20
|
-
# Terraform command to be executed
|
21
|
-
class Command
|
22
|
-
attr_reader :options, :target
|
23
|
-
|
24
|
-
def name
|
25
|
-
/(\w+)Command/.match(self.class.to_s) { |match| return match[1].downcase }
|
26
|
-
|
27
|
-
'help'
|
28
|
-
end
|
29
|
-
|
30
|
-
def prepare
|
31
|
-
preparations.each(&:execute)
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_s
|
35
|
-
"#{name} #{options} #{target}".strip
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
attr_accessor :preparations
|
41
|
-
|
42
|
-
attr_writer :options, :target
|
43
|
-
|
44
|
-
def initialize(target: '', &block)
|
45
|
-
block ||= proc {}
|
46
|
-
|
47
|
-
self.options = ::Terraform::CommandOptions.new
|
48
|
-
self.preparations = []
|
49
|
-
self.target = target
|
50
|
-
block.call options
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'terraform/apply_command'
|
18
|
-
require 'terraform/destructive_plan_command'
|
19
|
-
require 'terraform/get_command'
|
20
|
-
require 'terraform/output_command'
|
21
|
-
require 'terraform/plan_command'
|
22
|
-
require 'terraform/show_command'
|
23
|
-
require 'terraform/validate_command'
|
24
|
-
require 'terraform/version_command'
|
25
|
-
|
26
|
-
module Terraform
|
27
|
-
# A factory to create commands
|
28
|
-
class CommandFactory
|
29
|
-
def apply_command
|
30
|
-
::Terraform::ApplyCommand.new target: config[:plan] do |options|
|
31
|
-
options.color = config[:color]
|
32
|
-
options.input = false
|
33
|
-
options.parallelism = config[:parallelism]
|
34
|
-
options.state_out = config[:state]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def destructive_plan_command
|
39
|
-
::Terraform::DestructivePlanCommand
|
40
|
-
.new target: config[:directory] do |options|
|
41
|
-
configure_plan options: options
|
42
|
-
options.destroy = true
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def get_command
|
47
|
-
::Terraform::GetCommand.new target: config[:directory] do |options|
|
48
|
-
options.update = true
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def output_command(target:, version:)
|
53
|
-
version
|
54
|
-
.if_json_not_supported { return base_output_command target: target }
|
55
|
-
|
56
|
-
json_output_command target: target
|
57
|
-
end
|
58
|
-
|
59
|
-
def plan_command
|
60
|
-
::Terraform::PlanCommand.new target: config[:directory] do |options|
|
61
|
-
configure_plan options: options
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def show_command
|
66
|
-
::Terraform::ShowCommand.new target: config[:state] do |options|
|
67
|
-
options.color = config[:color]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
def validate_command
|
72
|
-
::Terraform::ValidateCommand.new target: config[:directory]
|
73
|
-
end
|
74
|
-
|
75
|
-
def version_command
|
76
|
-
::Terraform::VersionCommand.new
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
attr_accessor :config
|
82
|
-
|
83
|
-
def base_output_command(target:, &block)
|
84
|
-
block ||= proc {}
|
85
|
-
|
86
|
-
::Terraform::OutputCommand.new target: target do |options|
|
87
|
-
options.color = config[:color]
|
88
|
-
options.state = config[:state]
|
89
|
-
block.call options
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def configure_plan(options:)
|
94
|
-
options.color = config[:color]
|
95
|
-
options.input = false
|
96
|
-
options.out = config[:plan]
|
97
|
-
options.parallelism = config[:parallelism]
|
98
|
-
options.state = config[:state]
|
99
|
-
options.var = config[:variables]
|
100
|
-
options.var_file = config[:variable_files]
|
101
|
-
end
|
102
|
-
|
103
|
-
def initialize(config:)
|
104
|
-
self.config = config
|
105
|
-
end
|
106
|
-
|
107
|
-
def json_output_command(target:)
|
108
|
-
base_output_command(target: target) { |options| options.json = true }
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
module Terraform
|
18
|
-
# An option for a command
|
19
|
-
class CommandOption
|
20
|
-
attr_reader :key, :value
|
21
|
-
|
22
|
-
def ==(other)
|
23
|
-
tuple == other.tuple
|
24
|
-
end
|
25
|
-
|
26
|
-
alias eql? ==
|
27
|
-
|
28
|
-
def hash
|
29
|
-
stripped_key.hash & stripped_value.hash
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_s
|
33
|
-
"#{formatted_key}#{formatted_value}"
|
34
|
-
end
|
35
|
-
|
36
|
-
def tuple
|
37
|
-
[stripped_key, stripped_value]
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
attr_accessor :stripped_key, :stripped_value
|
43
|
-
|
44
|
-
attr_writer :key, :value
|
45
|
-
|
46
|
-
def initialize(key:, value: '')
|
47
|
-
self.key = key
|
48
|
-
self.stripped_key = stripped_string config_string: key
|
49
|
-
self.stripped_value = stripped_string config_string: value
|
50
|
-
self.value = value
|
51
|
-
end
|
52
|
-
|
53
|
-
def formatted_key
|
54
|
-
"-#{stripped_key}"
|
55
|
-
end
|
56
|
-
|
57
|
-
def formatted_value
|
58
|
-
stripped_value.sub(/(\S)/, '=\1')
|
59
|
-
end
|
60
|
-
|
61
|
-
def stripped_string(config_string:)
|
62
|
-
String(config_string).gsub(/\s/, '')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright 2016 New Context Services, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require 'set'
|
18
|
-
require_relative 'command_option'
|
19
|
-
|
20
|
-
module Terraform
|
21
|
-
# Options for commands
|
22
|
-
class CommandOptions
|
23
|
-
def color=(value)
|
24
|
-
store key: { false => 'no-color' }.fetch(value) { return }
|
25
|
-
end
|
26
|
-
|
27
|
-
def destroy=(value)
|
28
|
-
store key: 'destroy', value: value
|
29
|
-
end
|
30
|
-
|
31
|
-
def input=(value)
|
32
|
-
store key: 'input', value: value
|
33
|
-
end
|
34
|
-
|
35
|
-
def json=(value)
|
36
|
-
store key: 'json', value: value
|
37
|
-
end
|
38
|
-
|
39
|
-
def out
|
40
|
-
fetch key: 'out'
|
41
|
-
end
|
42
|
-
|
43
|
-
def out=(value)
|
44
|
-
store key: 'out', value: value
|
45
|
-
end
|
46
|
-
|
47
|
-
def parallelism=(value)
|
48
|
-
store key: 'parallelism', value: value
|
49
|
-
end
|
50
|
-
|
51
|
-
def state
|
52
|
-
fetch key: 'state'
|
53
|
-
end
|
54
|
-
|
55
|
-
def state=(value)
|
56
|
-
store key: 'state', value: value
|
57
|
-
end
|
58
|
-
|
59
|
-
def state_out
|
60
|
-
fetch key: 'state-out'
|
61
|
-
end
|
62
|
-
|
63
|
-
def state_out=(value)
|
64
|
-
store key: 'state-out', value: value
|
65
|
-
end
|
66
|
-
|
67
|
-
def update=(value)
|
68
|
-
store key: 'update', value: value
|
69
|
-
end
|
70
|
-
|
71
|
-
def var=(value)
|
72
|
-
value.each_pair do |variable_name, variable_value|
|
73
|
-
store key: 'var', value: "'#{variable_name}=#{variable_value}'"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def var_file=(value)
|
78
|
-
value.each { |file| store key: 'var-file', value: file }
|
79
|
-
end
|
80
|
-
|
81
|
-
def to_s
|
82
|
-
options.each_with_object ::String.new do |option, string|
|
83
|
-
string.concat "#{option} "
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
attr_accessor :options
|
90
|
-
|
91
|
-
def fetch(key:)
|
92
|
-
options.find { |option| option.key == key }.value
|
93
|
-
end
|
94
|
-
|
95
|
-
def initialize(options: ::Set.new)
|
96
|
-
self.options = options
|
97
|
-
end
|
98
|
-
|
99
|
-
def store(**keyword_arguments)
|
100
|
-
options.add ::Terraform::CommandOption.new(**keyword_arguments)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|