kitchen-terraform 5.8.0 → 6.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 +0 -0
- data/README.md +17 -16
- data/lib/kitchen/driver/terraform.rb +1 -1
- data/lib/kitchen/provisioner/terraform.rb +1 -1
- data/lib/kitchen/terraform.rb +1 -1
- data/lib/kitchen/terraform/breaking.rb +1 -1
- data/lib/kitchen/terraform/command.rb +1 -1
- data/lib/kitchen/terraform/command/apply.rb +1 -1
- data/lib/kitchen/terraform/command/destroy.rb +1 -1
- data/lib/kitchen/terraform/command/get.rb +1 -1
- data/lib/kitchen/terraform/command/init.rb +1 -1
- data/lib/kitchen/terraform/command/init/post_zero_fifteen_zero.rb +1 -1
- data/lib/kitchen/terraform/command/init/pre_zero_fifteen_zero.rb +1 -1
- data/lib/kitchen/terraform/command/init_factory.rb +1 -1
- data/lib/kitchen/terraform/command/output.rb +1 -1
- data/lib/kitchen/terraform/command/validate.rb +1 -1
- data/lib/kitchen/terraform/command/validate/post_zero_fifteen_zero.rb +1 -1
- data/lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb +1 -1
- data/lib/kitchen/terraform/command/validate_factory.rb +1 -1
- data/lib/kitchen/terraform/command/version.rb +1 -1
- data/lib/kitchen/terraform/command/workspace_delete.rb +1 -1
- data/lib/kitchen/terraform/command/workspace_new.rb +1 -1
- data/lib/kitchen/terraform/command/workspace_select.rb +1 -1
- data/lib/kitchen/terraform/command_executor.rb +3 -5
- data/lib/kitchen/terraform/command_flag.rb +1 -1
- data/lib/kitchen/terraform/command_flag/backend_config.rb +1 -1
- data/lib/kitchen/terraform/command_flag/color.rb +1 -1
- data/lib/kitchen/terraform/command_flag/lock_timeout.rb +1 -1
- data/lib/kitchen/terraform/command_flag/plugin_dir.rb +1 -1
- data/lib/kitchen/terraform/command_flag/upgrade.rb +1 -1
- data/lib/kitchen/terraform/command_flag/var.rb +1 -1
- data/lib/kitchen/terraform/command_flag/var_file.rb +1 -1
- data/lib/kitchen/terraform/config_attribute.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/backend_configurations.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/client.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/color.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/command_timeout.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/fail_fast.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/lock.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/lock_timeout.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/parallelism.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/plugin_directory.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/root_module_directory.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/systems.rb +552 -4
- data/lib/kitchen/terraform/config_attribute/variable_files.rb +3 -3
- data/lib/kitchen/terraform/config_attribute/variables.rb +1 -1
- data/lib/kitchen/terraform/config_attribute/verify_version.rb +3 -3
- data/lib/kitchen/terraform/config_attribute_cacher.rb +1 -1
- data/lib/kitchen/terraform/{config_predicates.rb → config_attribute_contract.rb} +3 -3
- data/lib/kitchen/terraform/config_attribute_contract/array_of_strings.rb +30 -0
- data/lib/kitchen/terraform/{config_schemas → config_attribute_contract}/boolean.rb +7 -11
- data/lib/kitchen/terraform/config_attribute_contract/hash_of_symbols_and_strings.rb +41 -0
- data/lib/kitchen/terraform/{config_schemas.rb → config_attribute_contract/integer.rb} +10 -3
- data/lib/kitchen/terraform/config_attribute_contract/optional_string.rb +30 -0
- data/lib/kitchen/terraform/{config_schemas → config_attribute_contract}/string.rb +7 -9
- data/lib/kitchen/terraform/config_attribute_contract/systems.rb +63 -0
- data/lib/kitchen/terraform/config_attribute_definer.rb +2 -2
- data/lib/kitchen/terraform/config_attribute_type.rb +1 -1
- data/lib/kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings.rb +9 -16
- data/lib/kitchen/terraform/config_attribute_type/integer.rb +27 -23
- data/lib/kitchen/terraform/configurable.rb +1 -1
- data/lib/kitchen/terraform/debug_logger.rb +1 -1
- data/lib/kitchen/terraform/deprecating.rb +1 -1
- data/lib/kitchen/terraform/driver.rb +1 -1
- data/lib/kitchen/terraform/driver/create.rb +5 -5
- data/lib/kitchen/terraform/driver/destroy.rb +8 -8
- data/lib/kitchen/terraform/error.rb +1 -1
- data/lib/kitchen/terraform/file_path_config_attribute_definer.rb +1 -1
- data/lib/kitchen/terraform/inspec.rb +1 -1
- data/lib/kitchen/terraform/inspec/fail_fast_with_hosts.rb +1 -1
- data/lib/kitchen/terraform/inspec/fail_slow_with_hosts.rb +1 -1
- data/lib/kitchen/terraform/inspec/without_hosts.rb +1 -1
- data/lib/kitchen/terraform/inspec_factory.rb +1 -1
- data/lib/kitchen/terraform/inspec_options_factory.rb +1 -1
- data/lib/kitchen/terraform/inspec_runner.rb +1 -1
- data/lib/kitchen/terraform/outputs_manager.rb +1 -1
- data/lib/kitchen/terraform/outputs_parser.rb +1 -1
- data/lib/kitchen/terraform/outputs_reader.rb +2 -2
- data/lib/kitchen/terraform/provisioner.rb +1 -1
- data/lib/kitchen/terraform/provisioner/converge.rb +6 -6
- data/lib/kitchen/terraform/raise.rb +1 -1
- data/lib/kitchen/terraform/raise/action_failed.rb +1 -1
- data/lib/kitchen/terraform/raise/client_error.rb +1 -1
- data/lib/kitchen/terraform/shell_out.rb +2 -2
- data/lib/kitchen/terraform/system.rb +1 -1
- data/lib/kitchen/terraform/system_attrs_inputs_resolver.rb +1 -1
- data/lib/kitchen/terraform/system_attrs_outputs_resolver.rb +1 -1
- data/lib/kitchen/terraform/system_bastion_host_resolver.rb +1 -1
- data/lib/kitchen/terraform/system_hosts_resolver.rb +1 -1
- data/lib/kitchen/terraform/system_inspec_map.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier/fail_fast.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier/fail_slow.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier_factory.rb +1 -1
- data/lib/kitchen/terraform/unsupported_client_version_error.rb +1 -1
- data/lib/kitchen/terraform/variables_manager.rb +1 -1
- data/lib/kitchen/terraform/verify_version.rb +1 -1
- data/lib/kitchen/terraform/verify_version_rescue_strategy.rb +1 -1
- data/lib/kitchen/terraform/verify_version_rescue_strategy/permissive.rb +1 -1
- data/lib/kitchen/terraform/verify_version_rescue_strategy/strict.rb +1 -1
- data/lib/kitchen/terraform/verify_version_rescue_strategy_factory.rb +1 -1
- data/lib/kitchen/terraform/version.rb +2 -2
- data/lib/kitchen/terraform/version_verifier.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy/supported.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy/unsupported.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy_factory.rb +1 -1
- data/lib/kitchen/verifier/terraform.rb +1 -1
- metadata +60 -49
- metadata.gz.sig +0 -0
- data/lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb +0 -81
- data/lib/kitchen/terraform/config_schemas/array_of_strings.rb +0 -38
- data/lib/kitchen/terraform/config_schemas/optional_string.rb +0 -38
- data/lib/kitchen/terraform/config_schemas/system.rb +0 -609
- data/lib/kitchen/terraform/config_schemas/systems.rb +0 -37
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
require "kitchen/terraform/config_attribute"
|
18
18
|
require "kitchen/terraform/config_attribute_cacher"
|
19
|
-
require "kitchen/terraform/
|
19
|
+
require "kitchen/terraform/config_attribute_contract/array_of_strings"
|
20
20
|
require "kitchen/terraform/file_path_config_attribute_definer"
|
21
21
|
|
22
22
|
module Kitchen
|
@@ -42,7 +42,7 @@ module Kitchen
|
|
42
42
|
def included(plugin_class)
|
43
43
|
::Kitchen::Terraform::FilePathConfigAttributeDefiner.new(
|
44
44
|
attribute: self,
|
45
|
-
schema: ::Kitchen::Terraform::
|
45
|
+
schema: ::Kitchen::Terraform::ConfigAttributeContract::ArrayOfStrings.new,
|
46
46
|
).define plugin_class: plugin_class
|
47
47
|
end
|
48
48
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
require "kitchen"
|
18
18
|
require "kitchen/terraform/config_attribute"
|
19
|
-
require "kitchen/terraform/
|
19
|
+
require "kitchen/terraform/config_attribute_contract/boolean"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
module Terraform
|
@@ -34,7 +34,7 @@ module Kitchen
|
|
34
34
|
default_value: lambda do
|
35
35
|
true
|
36
36
|
end,
|
37
|
-
schema: ::Kitchen::Terraform::
|
37
|
+
schema: ::Kitchen::Terraform::ConfigAttributeContract::Boolean.new,
|
38
38
|
).apply config_attribute: self
|
39
39
|
end
|
40
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -16,8 +16,8 @@
|
|
16
16
|
|
17
17
|
module Kitchen
|
18
18
|
module Terraform
|
19
|
-
#
|
20
|
-
module
|
19
|
+
# ConfigAttributeContract is the namespace for configuration attribute contracts.
|
20
|
+
module ConfigAttributeContract
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
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 "dry/validation"
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
module Terraform
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# ArrayOfStrings is the class of objects that provide a configuration attribute contract for an array of strings.
|
23
|
+
class ArrayOfStrings < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).array :filled?, :str?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -18,16 +18,12 @@ require "dry/validation"
|
|
18
18
|
|
19
19
|
module Kitchen
|
20
20
|
module Terraform
|
21
|
-
module
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end.dup
|
28
|
-
|
29
|
-
Boolean.define_singleton_method :to_s do
|
30
|
-
"Kitchen::Terraform::ConfigSchemas::Boolean"
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# Boolean is the class of objects that provide a configuration attribute contract for a boolean.
|
23
|
+
class Boolean < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).filled :bool?
|
26
|
+
end
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
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 "dry/validation"
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
module Terraform
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# HashOfSymbolsAndStrings is the class of objects that provide a configuration attribute contract for a hash
|
23
|
+
# including only symbol keys and string values.
|
24
|
+
class HashOfSymbolsAndStrings < ::Dry::Validation::Contract
|
25
|
+
schema do
|
26
|
+
required(:value).hash
|
27
|
+
end
|
28
|
+
|
29
|
+
rule :value do
|
30
|
+
value.each_pair do |symbol, string|
|
31
|
+
if ::Symbol != symbol.class
|
32
|
+
key.failure "the key of the key-value pair '#{symbol} => #{string}' must be a scalar"
|
33
|
+
elsif ::String != string.class
|
34
|
+
key.failure "the value of the key-value pair '#{symbol} => #{string}' must be a scalar"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -14,10 +14,17 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
+
require "dry/validation"
|
18
|
+
|
17
19
|
module Kitchen
|
18
20
|
module Terraform
|
19
|
-
|
20
|
-
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# Integer is the class of objects that provide a configuration attribute contract for an integer.
|
23
|
+
class Integer < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).value :int?
|
26
|
+
end
|
27
|
+
end
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
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 "dry/validation"
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
module Terraform
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# OptionalString is the class of objects that provide a configuration attribute contract for an optional string.
|
23
|
+
class OptionalString < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).maybe :filled?, :str?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -18,14 +18,12 @@ require "dry/validation"
|
|
18
18
|
|
19
19
|
module Kitchen
|
20
20
|
module Terraform
|
21
|
-
module
|
22
|
-
#
|
23
|
-
String
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
String.define_singleton_method :to_s do
|
28
|
-
"Kitchen::Terraform::ConfigSchemas::String"
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# String is the class of objects that provide a configuration attribute contract for a string.
|
23
|
+
class String < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).filled :str?
|
26
|
+
end
|
29
27
|
end
|
30
28
|
end
|
31
29
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
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 "dry/validation"
|
18
|
+
|
19
|
+
module Kitchen
|
20
|
+
module Terraform
|
21
|
+
module ConfigAttributeContract
|
22
|
+
# Systems is the class of objects that provide a configuration attribute contract for systems.
|
23
|
+
class Systems < ::Dry::Validation::Contract
|
24
|
+
schema do
|
25
|
+
required(:value).array(:hash) do
|
26
|
+
required(:name).filled :str?
|
27
|
+
required(:backend).filled :str?
|
28
|
+
optional(:attrs).array(:filled?, :str?)
|
29
|
+
optional(:attrs_outputs).filled :hash?
|
30
|
+
optional(:backend_cache).value :bool?
|
31
|
+
optional(:bastion_host).filled :str?
|
32
|
+
optional(:bastion_host_output).filled :str?
|
33
|
+
optional(:bastion_port).value :int?
|
34
|
+
optional(:bastion_user).filled :str?
|
35
|
+
optional(:controls).array(:filled?, :str?)
|
36
|
+
optional(:enable_password).filled :str?
|
37
|
+
optional(:hosts).array :filled?, :str?
|
38
|
+
optional(:hosts_output).filled :str?
|
39
|
+
optional(:key_files).array(:filled?, :str?)
|
40
|
+
optional(:password).filled :str?
|
41
|
+
optional(:path).filled :str?
|
42
|
+
optional(:port).value :int?
|
43
|
+
optional(:profile_locations).array :filled?, :str?
|
44
|
+
optional(:proxy_command).filled :str?
|
45
|
+
optional(:reporter).array(:filled?, :str?)
|
46
|
+
optional(:self_signed).value :bool?
|
47
|
+
optional(:shell).value :bool?
|
48
|
+
optional(:shell_command).filled :str?
|
49
|
+
optional(:shell_options).filled :str?
|
50
|
+
optional(:show_progress).value :bool?
|
51
|
+
optional(:ssl).value :bool?
|
52
|
+
optional(:sudo).value :bool?
|
53
|
+
optional(:sudo_command).filled :str?
|
54
|
+
optional(:sudo_options).filled :str?
|
55
|
+
optional(:sudo_password).filled :str?
|
56
|
+
optional(:user).filled :str?
|
57
|
+
optional(:vendor_cache).filled :str?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -24,7 +24,7 @@ module Kitchen
|
|
24
24
|
# @return [self]
|
25
25
|
def define(plugin_class:)
|
26
26
|
plugin_class.required_config attribute do |_attribute, value, _plugin|
|
27
|
-
process messages: schema.call(value: value).
|
27
|
+
process messages: schema.call(value: value).errors.to_h, plugin_class: plugin_class
|
28
28
|
end
|
29
29
|
plugin_class.default_config attribute do |plugin|
|
30
30
|
plugin.send "config_#{attribute}_default_value"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -16,13 +16,13 @@
|
|
16
16
|
|
17
17
|
require "dry/validation"
|
18
18
|
require "kitchen/terraform/config_attribute"
|
19
|
-
require "kitchen/terraform/
|
19
|
+
require "kitchen/terraform/config_attribute_contract/hash_of_symbols_and_strings"
|
20
20
|
|
21
21
|
module Kitchen
|
22
22
|
module Terraform
|
23
23
|
module ConfigAttributeType
|
24
|
-
# This modules applies the behaviour of a configuration attribute of type hash of symbols and strings to a module
|
25
|
-
# must be included by a plugin class.
|
24
|
+
# This modules applies the behaviour of a configuration attribute of type hash of symbols and strings to a module
|
25
|
+
# which must be included by a plugin class.
|
26
26
|
#
|
27
27
|
# @see http://dry-rb.org/gems/dry-validation/basics/working-with-schemas/ DRY Validation Working With Schemas
|
28
28
|
module HashOfSymbolsAndStrings
|
@@ -33,18 +33,11 @@ module Kitchen
|
|
33
33
|
# @param default_value [Proc] a proc which returns the default value.
|
34
34
|
# @return [self]
|
35
35
|
def self.apply(attribute:, config_attribute:, default_value:)
|
36
|
-
::Kitchen::Terraform::ConfigAttribute
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
.Schema do
|
42
|
-
configure do
|
43
|
-
extend ::Kitchen::Terraform::ConfigPredicates::HashOfSymbolsAndStrings
|
44
|
-
end
|
45
|
-
required(:value).value :hash_of_symbols_and_strings?
|
46
|
-
end,
|
47
|
-
).apply config_attribute: config_attribute
|
36
|
+
::Kitchen::Terraform::ConfigAttribute.new(
|
37
|
+
attribute: attribute,
|
38
|
+
default_value: default_value,
|
39
|
+
schema: ::Kitchen::Terraform::ConfigAttributeContract::HashOfSymbolsAndStrings.new,
|
40
|
+
).apply config_attribute: config_attribute
|
48
41
|
|
49
42
|
self
|
50
43
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright 2016-
|
3
|
+
# Copyright 2016-2021 Copado NCS LLC
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -16,30 +16,34 @@
|
|
16
16
|
|
17
17
|
require "dry/validation"
|
18
18
|
require "kitchen/terraform/config_attribute"
|
19
|
+
require "kitchen/terraform/config_attribute_contract/integer"
|
19
20
|
require "kitchen/terraform/config_attribute_type"
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
attribute:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
module Kitchen
|
23
|
+
module Terraform
|
24
|
+
module ConfigAttributeType
|
25
|
+
# This module applies the behaviour of a configuration attribute of type integer to a module which must be
|
26
|
+
# included by a plugin class.
|
27
|
+
#
|
28
|
+
# @see http://dry-rb.org/gems/dry-validation/basics/working-with-schemas/ DRY Validation Working With Schemas
|
29
|
+
module Integer
|
30
|
+
# This method applies the configuration attribute behaviour to a module.
|
31
|
+
#
|
32
|
+
# @param attribute [Symbol] the symbol corresponding to the configuration attribute.
|
33
|
+
# @param config_attribute [Module] a module.
|
34
|
+
# @param default_value [Proc] a proc which returns the default value.
|
35
|
+
# @return [self]
|
36
|
+
def self.apply(attribute:, config_attribute:, default_value:)
|
37
|
+
::Kitchen::Terraform::ConfigAttribute
|
38
|
+
.new(
|
39
|
+
attribute: attribute,
|
40
|
+
default_value: default_value,
|
41
|
+
schema: ::Kitchen::Terraform::ConfigAttributeContract::Integer.new,
|
42
|
+
).apply config_attribute: config_attribute
|
42
43
|
|
43
|
-
|
44
|
+
self
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
44
48
|
end
|
45
49
|
end
|