kitchen-terraform 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +3 -3
- data/lib/kitchen/driver/terraform.rb +363 -221
- data/lib/kitchen/provisioner/terraform.rb +2 -3
- data/lib/kitchen/terraform.rb +3 -1
- data/lib/kitchen/terraform/clear_directory.rb +38 -0
- data/lib/kitchen/terraform/client/command.rb +168 -0
- data/lib/kitchen/terraform/client/options.rb +275 -0
- data/lib/kitchen/terraform/client_version_verifier.rb +57 -0
- data/lib/{terraform/debug_logger.rb → kitchen/terraform/config_attribute.rb} +7 -13
- data/lib/kitchen/terraform/config_attribute/backend_configurations.rb +53 -0
- data/lib/kitchen/terraform/config_attribute/color.rb +56 -0
- data/lib/kitchen/terraform/config_attribute/command_timeout.rb +52 -0
- data/lib/kitchen/terraform/config_attribute/directory.rb +54 -0
- data/lib/kitchen/terraform/config_attribute/groups.rb +96 -0
- data/lib/kitchen/terraform/config_attribute/lock_timeout.rb +52 -0
- data/lib/kitchen/terraform/config_attribute/parallelism.rb +53 -0
- data/lib/kitchen/terraform/config_attribute/plugin_directory.rb +55 -0
- data/lib/kitchen/terraform/config_attribute/state.rb +55 -0
- data/lib/kitchen/terraform/config_attribute/variable_files.rb +51 -0
- data/lib/kitchen/terraform/config_attribute/variables.rb +53 -0
- data/lib/kitchen/terraform/config_attribute/verify_plugins.rb +52 -0
- data/lib/kitchen/terraform/config_attribute_cacher.rb +44 -0
- data/lib/kitchen/terraform/config_attribute_definer.rb +66 -0
- data/lib/kitchen/terraform/config_predicates.rb +21 -0
- data/lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb +72 -0
- data/lib/{terraform.rb → kitchen/terraform/config_schemas.rb} +4 -2
- data/lib/kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings.rb +47 -0
- data/lib/kitchen/terraform/config_schemas/array_of_strings.rb +31 -0
- data/lib/kitchen/terraform/config_schemas/boolean.rb +27 -0
- data/lib/kitchen/terraform/config_schemas/hash_of_symbols_and_strings.rb +32 -0
- data/lib/kitchen/terraform/config_schemas/integer.rb +27 -0
- data/lib/kitchen/terraform/config_schemas/optional_string.rb +31 -0
- data/lib/kitchen/terraform/config_schemas/string.rb +26 -0
- data/lib/kitchen/terraform/configurable.rb +75 -0
- data/lib/kitchen/terraform/file_path_config_attribute_definer.rb +48 -0
- data/lib/{terraform/project_version.rb → kitchen/terraform/version.rb} +3 -3
- data/lib/kitchen/verifier/terraform.rb +40 -129
- data/lib/kitchen/verifier/terraform/configure_inspec_runner_attributes.rb +7 -4
- data/lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb +2 -2
- metadata +69 -43
- metadata.gz.sig +0 -0
- data/lib/kitchen/driver/terraform/verify_client_version.rb +0 -44
- data/lib/kitchen/driver/terraform/workflow.rb +0 -90
- data/lib/kitchen/terraform/client/apply.rb +0 -38
- data/lib/kitchen/terraform/client/execute_command.rb +0 -56
- data/lib/kitchen/terraform/client/get.rb +0 -35
- data/lib/kitchen/terraform/client/output.rb +0 -50
- data/lib/kitchen/terraform/client/plan.rb +0 -42
- data/lib/kitchen/terraform/client/process_options.rb +0 -87
- data/lib/kitchen/terraform/client/validate.rb +0 -35
- data/lib/kitchen/terraform/client/version.rb +0 -48
- data/lib/kitchen/terraform/define_config_attribute.rb +0 -39
- data/lib/kitchen/terraform/define_integer_config_attribute.rb +0 -43
- data/lib/kitchen/terraform/define_string_config_attribute.rb +0 -43
- data/lib/terraform/configurable.rb +0 -42
@@ -0,0 +1,57 @@
|
|
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 "dry/monads"
|
18
|
+
require "kitchen/terraform"
|
19
|
+
require "rubygems"
|
20
|
+
|
21
|
+
# Verifies that the output of the Terraform Client version subcommand indicates a supported version of Terraform.
|
22
|
+
class ::Kitchen::Terraform::ClientVersionVerifier
|
23
|
+
include ::Dry::Monads::Either::Mixin
|
24
|
+
|
25
|
+
# Verifies output from the Terraform Client version subcommand against the support version.
|
26
|
+
#
|
27
|
+
# Supported:: Terraform version ~> 0.10.2.
|
28
|
+
#
|
29
|
+
# @param version_output [::String] the Terraform Client version subcommand output.
|
30
|
+
# @return [::Dry::Monads::Either] the result of the function.
|
31
|
+
def verify(version_output:)
|
32
|
+
Right(
|
33
|
+
::Gem::Version
|
34
|
+
.new(
|
35
|
+
version_output
|
36
|
+
.slice(
|
37
|
+
/v(\d+\.\d+\.\d+)/,
|
38
|
+
1
|
39
|
+
)
|
40
|
+
)
|
41
|
+
).bind do |version|
|
42
|
+
if requirement.satisfied_by? version
|
43
|
+
Right "Terraform version #{version} is supported"
|
44
|
+
else
|
45
|
+
Left "Terraform version #{version} is not supported; upgrade to Terraform version ~> 0.10.2"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
attr_reader :requirement
|
53
|
+
|
54
|
+
def initialize
|
55
|
+
@requirement = ::Gem::Requirement.new "~> 0.10.2"
|
56
|
+
end
|
57
|
+
end
|
@@ -14,21 +14,15 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require "terraform"
|
17
|
+
require "kitchen/terraform"
|
18
18
|
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
# The namespace for configuration attributes.
|
20
|
+
#
|
21
|
+
# @abstract It defines the interface for configuration attributes to implement.
|
22
|
+
module ::Kitchen::Terraform::ConfigAttribute
|
23
|
+
def self.default_value(_plugin:)
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
attr_accessor :logger
|
30
|
-
|
31
|
-
def initialize(logger:)
|
32
|
-
self.logger = logger
|
26
|
+
def self.to_sym
|
33
27
|
end
|
34
28
|
end
|
@@ -0,0 +1,53 @@
|
|
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 "kitchen/terraform/config_attribute"
|
18
|
+
require "kitchen/terraform/config_attribute_cacher"
|
19
|
+
require "kitchen/terraform/config_attribute_definer"
|
20
|
+
require "kitchen/terraform/config_schemas/hash_of_symbols_and_strings"
|
21
|
+
|
22
|
+
# The +:backend_configurations+ configuration attribute is an optional hash of symobls and strings comprising Terraform
|
23
|
+
# backend configuration arguments to complete a partial backend.
|
24
|
+
#
|
25
|
+
# @abstract It must be included by a plugin class in order to be used.
|
26
|
+
# @see https://www.terraform.io/docs/backends/config.html#partial-configuration Terraform: Backend Configuration:
|
27
|
+
# Partial Configuration
|
28
|
+
module ::Kitchen::Terraform::ConfigAttribute::BackendConfigurations
|
29
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
30
|
+
#
|
31
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
32
|
+
# @return [void]
|
33
|
+
def self.included(plugin_class)
|
34
|
+
::Kitchen::Terraform::ConfigAttributeDefiner
|
35
|
+
.new(
|
36
|
+
attribute: self,
|
37
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::HashOfSymbolsAndStrings
|
38
|
+
)
|
39
|
+
.define plugin_class: plugin_class
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
43
|
+
def self.to_sym
|
44
|
+
:backend_configurations
|
45
|
+
end
|
46
|
+
|
47
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
48
|
+
|
49
|
+
# @return [::Hash] an empty hash.
|
50
|
+
def config_backend_configurations_default_value
|
51
|
+
{}
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 "kitchen"
|
18
|
+
require "kitchen/terraform/config_attribute"
|
19
|
+
require "kitchen/terraform/config_attribute_cacher"
|
20
|
+
require "kitchen/terraform/config_attribute_definer"
|
21
|
+
require "kitchen/terraform/config_schemas/boolean"
|
22
|
+
|
23
|
+
# The +:color+ configuration attribute is an optional boolean which toggles colored output from the Terraform Client
|
24
|
+
# commands.
|
25
|
+
#
|
26
|
+
# @abstract It must be included by plugin class in order to be used.
|
27
|
+
# @see ::Kitchen::Terraform::Client::Command
|
28
|
+
module ::Kitchen::Terraform::ConfigAttribute::Color
|
29
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
30
|
+
#
|
31
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
32
|
+
# @return [void]
|
33
|
+
def self.included(plugin_class)
|
34
|
+
::Kitchen::Terraform::ConfigAttributeDefiner
|
35
|
+
.new(
|
36
|
+
attribute: self,
|
37
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::Boolean
|
38
|
+
)
|
39
|
+
.define plugin_class: plugin_class
|
40
|
+
end
|
41
|
+
|
42
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
43
|
+
def self.to_sym
|
44
|
+
:color
|
45
|
+
end
|
46
|
+
|
47
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
48
|
+
|
49
|
+
# The default value depends on the presence of a terminal device associated with the Test Kitchen process.
|
50
|
+
#
|
51
|
+
# @return [Boolean] if a terminal device is associated then +true+; else +false+.
|
52
|
+
# @see https://en.wikipedia.org/wiki/Terminal_emulator Terminal emulator
|
53
|
+
def config_color_default_value
|
54
|
+
::Kitchen.tty?
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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 "kitchen/terraform/config_attribute"
|
18
|
+
require "kitchen/terraform/config_attribute_cacher"
|
19
|
+
require "kitchen/terraform/config_attribute_definer"
|
20
|
+
require "kitchen/terraform/config_schemas/integer"
|
21
|
+
|
22
|
+
# The +:command_timeout+ configuration attribute is an optional integer which represents the number of seconds to wait
|
23
|
+
# for the Terraform Client commands to finish.
|
24
|
+
#
|
25
|
+
# @abstract It must be included by a plugin class in order to be used.
|
26
|
+
# @see ::Kitchen::Terraform::Client::Command
|
27
|
+
module ::Kitchen::Terraform::ConfigAttribute::CommandTimeout
|
28
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
29
|
+
#
|
30
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
31
|
+
# @return [void]
|
32
|
+
def self.included(plugin_class)
|
33
|
+
::Kitchen::Terraform::ConfigAttributeDefiner
|
34
|
+
.new(
|
35
|
+
attribute: self,
|
36
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::Integer
|
37
|
+
)
|
38
|
+
.define plugin_class: plugin_class
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
42
|
+
def self.to_sym
|
43
|
+
:command_timeout
|
44
|
+
end
|
45
|
+
|
46
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
47
|
+
|
48
|
+
# @return [::Integer] 600 seconds.
|
49
|
+
def config_command_timeout_default_value
|
50
|
+
600
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,54 @@
|
|
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 "kitchen/terraform/config_attribute"
|
18
|
+
require "kitchen/terraform/config_attribute_cacher"
|
19
|
+
require "kitchen/terraform/config_schemas/string"
|
20
|
+
require "kitchen/terraform/file_path_config_attribute_definer"
|
21
|
+
|
22
|
+
# The +:directory+ configuration attribute is an optional string which contains the path to the directory containing the
|
23
|
+
# root Terraform module to be tested.
|
24
|
+
#
|
25
|
+
# @abstract It must be included by a plugin class in order to be used.
|
26
|
+
# @see https://www.terraform.io/docs/commands/init.html#copy-a-source-module Terraform: Command: init: Copy a Source
|
27
|
+
# Module
|
28
|
+
# @see https://en.wikipedia.org/wiki/Working_directory Working directory
|
29
|
+
module ::Kitchen::Terraform::ConfigAttribute::Directory
|
30
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
31
|
+
#
|
32
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
33
|
+
# @return [void]
|
34
|
+
def self.included(plugin_class)
|
35
|
+
::Kitchen::Terraform::FilePathConfigAttributeDefiner
|
36
|
+
.new(
|
37
|
+
attribute: self,
|
38
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::String
|
39
|
+
)
|
40
|
+
.define plugin_class: plugin_class
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
44
|
+
def self.to_sym
|
45
|
+
:directory
|
46
|
+
end
|
47
|
+
|
48
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
49
|
+
|
50
|
+
# @return [::String] the working directory of the Test Kitchen process.
|
51
|
+
def config_directory_default_value
|
52
|
+
"."
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,96 @@
|
|
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 "kitchen/terraform/config_attribute"
|
18
|
+
require "kitchen/terraform/config_attribute_cacher"
|
19
|
+
require "kitchen/terraform/config_attribute_definer"
|
20
|
+
require "kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings"
|
21
|
+
|
22
|
+
# The +:groups+ configuration attribute is an optional array including hashes comprising properties to manage the
|
23
|
+
# execution of InSpec profiles against different resources in the Terraform state.
|
24
|
+
#
|
25
|
+
# === Hash Keys
|
26
|
+
#
|
27
|
+
# ==== name
|
28
|
+
#
|
29
|
+
# A required string which contains the name of the group.
|
30
|
+
#
|
31
|
+
# ==== attributes
|
32
|
+
#
|
33
|
+
# An optional hash of symbols and strings which associates the names of InSpec profile attributes to the names of
|
34
|
+
# Terraform outputs.
|
35
|
+
#
|
36
|
+
# The attributes will be associated with the values of the outputs when InSpec runs.
|
37
|
+
#
|
38
|
+
# ==== controls
|
39
|
+
#
|
40
|
+
# An optional array of strings which contain the names of controls to exclusively include from the InSpec profile of the
|
41
|
+
# Test Kitchen suite.
|
42
|
+
#
|
43
|
+
# ==== hostnames
|
44
|
+
#
|
45
|
+
# An optional string which contains the name of a Terraform output.
|
46
|
+
#
|
47
|
+
# The output must be of type String or Array and must contain one or more hostnames that will be the targets of the
|
48
|
+
# InSpec profile of the Test Kitchen suite.
|
49
|
+
#
|
50
|
+
# If this key is omitted then localhost will be the target of the profile.
|
51
|
+
#
|
52
|
+
# ==== port
|
53
|
+
#
|
54
|
+
# An optional integer which represents the port to use when connecting to the hosts of the group with Secure Shell
|
55
|
+
# (SSH).
|
56
|
+
#
|
57
|
+
# If this key is omitted then the port of the Test Kitchen SSH Transport will be used.
|
58
|
+
#
|
59
|
+
# ==== username
|
60
|
+
#
|
61
|
+
# An optional string which contains the username to use when connecting to the hosts of the group with SSH.
|
62
|
+
#
|
63
|
+
# If this key is omitted then the username of the Test Kitcen SSH Transport will be used.
|
64
|
+
#
|
65
|
+
# @abstract It must be included by a plugin class in order to be used.
|
66
|
+
# @see https://github.com/test-kitchen/test-kitchen/blob/master/lib/kitchen/transport/ssh.rb Test Kitchen: SSH Transport
|
67
|
+
# @see https://www.inspec.io/docs/reference/dsl_inspec/ InSpec: Controls
|
68
|
+
# @see https://www.inspec.io/docs/reference/profiles/ InSpec: Profiles
|
69
|
+
# @see https://www.terraform.io/docs/configuration/outputs.html Terraform: Output Variables
|
70
|
+
# @see https://www.terraform.io/docs/state/index.html Terraform: State
|
71
|
+
module ::Kitchen::Terraform::ConfigAttribute::Groups
|
72
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
73
|
+
#
|
74
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
75
|
+
# @return [void]
|
76
|
+
def self.included(plugin_class)
|
77
|
+
::Kitchen::Terraform::ConfigAttributeDefiner
|
78
|
+
.new(
|
79
|
+
attribute: self,
|
80
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::ArrayOfHashesOfSymbolsAndStrings
|
81
|
+
)
|
82
|
+
.define plugin_class: plugin_class
|
83
|
+
end
|
84
|
+
|
85
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
86
|
+
def self.to_sym
|
87
|
+
:groups
|
88
|
+
end
|
89
|
+
|
90
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
91
|
+
|
92
|
+
# @return [::Array] an empty array.
|
93
|
+
def config_groups_default_value
|
94
|
+
[]
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,52 @@
|
|
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 "kitchen/terraform/config_attribute"
|
18
|
+
require "kitchen/terraform/config_attribute_cacher"
|
19
|
+
require "kitchen/terraform/config_attribute_definer"
|
20
|
+
require "kitchen/terraform/config_schemas/string"
|
21
|
+
|
22
|
+
# The +:lock_timeout+ configuration attribute is an optional string which contains the duration to wait for a lock on
|
23
|
+
# the Terraform state to be obtained.
|
24
|
+
#
|
25
|
+
# @abstract It must be included by a plugin class in order to be used.
|
26
|
+
# @see https://www.terraform.io/docs/commands/apply.html#lock-timeout-0s Terraform: Command: apply: -lock-timeout
|
27
|
+
module ::Kitchen::Terraform::ConfigAttribute::LockTimeout
|
28
|
+
# A callback to define the configuration attribute which is invoked when this module is included in a plugin class.
|
29
|
+
#
|
30
|
+
# @param plugin_class [::Kitchen::Configurable] A plugin class.
|
31
|
+
# @return [void]
|
32
|
+
def self.included(plugin_class)
|
33
|
+
::Kitchen::Terraform::ConfigAttributeDefiner
|
34
|
+
.new(
|
35
|
+
attribute: self,
|
36
|
+
schema: ::Kitchen::Terraform::ConfigSchemas::String
|
37
|
+
)
|
38
|
+
.define plugin_class: plugin_class
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [::Symbol] the symbol corresponding to the attribute.
|
42
|
+
def self.to_sym
|
43
|
+
:lock_timeout
|
44
|
+
end
|
45
|
+
|
46
|
+
extend ::Kitchen::Terraform::ConfigAttributeCacher
|
47
|
+
|
48
|
+
# @return [::String] 0 seconds.
|
49
|
+
def config_lock_timeout_default_value
|
50
|
+
"0s"
|
51
|
+
end
|
52
|
+
end
|