kitchen-terraform 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +3 -3
  5. data/lib/kitchen/driver/terraform.rb +363 -221
  6. data/lib/kitchen/provisioner/terraform.rb +2 -3
  7. data/lib/kitchen/terraform.rb +3 -1
  8. data/lib/kitchen/terraform/clear_directory.rb +38 -0
  9. data/lib/kitchen/terraform/client/command.rb +168 -0
  10. data/lib/kitchen/terraform/client/options.rb +275 -0
  11. data/lib/kitchen/terraform/client_version_verifier.rb +57 -0
  12. data/lib/{terraform/debug_logger.rb → kitchen/terraform/config_attribute.rb} +7 -13
  13. data/lib/kitchen/terraform/config_attribute/backend_configurations.rb +53 -0
  14. data/lib/kitchen/terraform/config_attribute/color.rb +56 -0
  15. data/lib/kitchen/terraform/config_attribute/command_timeout.rb +52 -0
  16. data/lib/kitchen/terraform/config_attribute/directory.rb +54 -0
  17. data/lib/kitchen/terraform/config_attribute/groups.rb +96 -0
  18. data/lib/kitchen/terraform/config_attribute/lock_timeout.rb +52 -0
  19. data/lib/kitchen/terraform/config_attribute/parallelism.rb +53 -0
  20. data/lib/kitchen/terraform/config_attribute/plugin_directory.rb +55 -0
  21. data/lib/kitchen/terraform/config_attribute/state.rb +55 -0
  22. data/lib/kitchen/terraform/config_attribute/variable_files.rb +51 -0
  23. data/lib/kitchen/terraform/config_attribute/variables.rb +53 -0
  24. data/lib/kitchen/terraform/config_attribute/verify_plugins.rb +52 -0
  25. data/lib/kitchen/terraform/config_attribute_cacher.rb +44 -0
  26. data/lib/kitchen/terraform/config_attribute_definer.rb +66 -0
  27. data/lib/kitchen/terraform/config_predicates.rb +21 -0
  28. data/lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb +72 -0
  29. data/lib/{terraform.rb → kitchen/terraform/config_schemas.rb} +4 -2
  30. data/lib/kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings.rb +47 -0
  31. data/lib/kitchen/terraform/config_schemas/array_of_strings.rb +31 -0
  32. data/lib/kitchen/terraform/config_schemas/boolean.rb +27 -0
  33. data/lib/kitchen/terraform/config_schemas/hash_of_symbols_and_strings.rb +32 -0
  34. data/lib/kitchen/terraform/config_schemas/integer.rb +27 -0
  35. data/lib/kitchen/terraform/config_schemas/optional_string.rb +31 -0
  36. data/lib/kitchen/terraform/config_schemas/string.rb +26 -0
  37. data/lib/kitchen/terraform/configurable.rb +75 -0
  38. data/lib/kitchen/terraform/file_path_config_attribute_definer.rb +48 -0
  39. data/lib/{terraform/project_version.rb → kitchen/terraform/version.rb} +3 -3
  40. data/lib/kitchen/verifier/terraform.rb +40 -129
  41. data/lib/kitchen/verifier/terraform/configure_inspec_runner_attributes.rb +7 -4
  42. data/lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb +2 -2
  43. metadata +69 -43
  44. metadata.gz.sig +0 -0
  45. data/lib/kitchen/driver/terraform/verify_client_version.rb +0 -44
  46. data/lib/kitchen/driver/terraform/workflow.rb +0 -90
  47. data/lib/kitchen/terraform/client/apply.rb +0 -38
  48. data/lib/kitchen/terraform/client/execute_command.rb +0 -56
  49. data/lib/kitchen/terraform/client/get.rb +0 -35
  50. data/lib/kitchen/terraform/client/output.rb +0 -50
  51. data/lib/kitchen/terraform/client/plan.rb +0 -42
  52. data/lib/kitchen/terraform/client/process_options.rb +0 -87
  53. data/lib/kitchen/terraform/client/validate.rb +0 -35
  54. data/lib/kitchen/terraform/client/version.rb +0 -48
  55. data/lib/kitchen/terraform/define_config_attribute.rb +0 -39
  56. data/lib/kitchen/terraform/define_integer_config_attribute.rb +0 -43
  57. data/lib/kitchen/terraform/define_string_config_attribute.rb +0 -43
  58. data/lib/terraform/configurable.rb +0 -42
@@ -1,39 +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 "dry-validation"
18
- require "kitchen"
19
- require "kitchen/terraform"
20
-
21
- # Defines a configuration attribute for a plugin class.
22
- #
23
- # @see http://dry-rb.org/gems/dry-validation/ DRY Validation
24
- module ::Kitchen::Terraform::DefineConfigAttribute
25
- # Invokes the function.
26
- #
27
- # @param attribute [::Symbol] the name of the attribute.
28
- # @param initialize_default_value [::Proc] a proc to lazily provide a default value.
29
- # @param plugin_class [::Class] the plugin class on which the attribute will be defined.
30
- # @param schema [::Proc] a proc to define the validation schema of the attribute.
31
- def self.call(attribute:, initialize_default_value:, plugin_class:, schema:)
32
- plugin_class.required_config attribute do |_attribute, value, plugin|
33
- ::Dry::Validation.Schema(&schema).call(value: value).messages.tap do |messages|
34
- raise ::Kitchen::UserError, "#{plugin.class} configuration: #{attribute} #{messages}" if not messages.empty?
35
- end
36
- end
37
- plugin_class.default_config attribute, &initialize_default_value
38
- end
39
- end
@@ -1,43 +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 "dry-validation"
18
- require "kitchen"
19
- require "kitchen/terraform"
20
- require "kitchen/terraform/define_config_attribute"
21
-
22
- # Defines an integer configuration attribute for a plugin class.
23
- #
24
- # @see http://dry-rb.org/gems/dry-validation/ DRY Validation
25
- module ::Kitchen::Terraform::DefineIntegerConfigAttribute
26
- # Invokes the function.
27
- #
28
- # @param attribute [::Symbol] the name of the attribute.
29
- # @param plugin_class [::Class] the plugin class on which the attribute will be defined.
30
- # @yieldparam plugin [::Kitchen::Driver::Terraform, ::Kitchen::Provisioner::Terraform, ::Kitchen::Verifier::Terraform]
31
- # an instance of the plugin class.
32
- # @yieldreturn [::Object] the default value of the attribute.
33
- def self.call(attribute:, plugin_class:, &initialize_default_value)
34
- ::Kitchen::Terraform::DefineConfigAttribute.call(
35
- attribute: attribute,
36
- initialize_default_value: initialize_default_value,
37
- plugin_class: plugin_class,
38
- schema: lambda do
39
- required(:value).filled :int?
40
- end
41
- )
42
- end
43
- end
@@ -1,43 +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 "dry-validation"
18
- require "kitchen"
19
- require "kitchen/terraform"
20
- require "kitchen/terraform/define_config_attribute"
21
-
22
- # Defines a string configuration attribute for a plugin class.
23
- #
24
- # @see http://dry-rb.org/gems/dry-validation/ DRY Validation
25
- module ::Kitchen::Terraform::DefineStringConfigAttribute
26
- # Invokes the function.
27
- #
28
- # @param attribute [::Symbol] the name of the attribute.
29
- # @param plugin_class [::Class] the plugin class on which the attribute will be defined.
30
- # @yieldparam plugin [::Kitchen::Driver::Terraform, ::Kitchen::Provisioner::Terraform, ::Kitchen::Verifier::Terraform]
31
- # an instance of the plugin class.
32
- # @yieldreturn [::Object] the default value of the attribute.
33
- def self.call(attribute:, plugin_class:, &initialize_default_value)
34
- ::Kitchen::Terraform::DefineConfigAttribute.call(
35
- attribute: attribute,
36
- initialize_default_value: initialize_default_value,
37
- plugin_class: plugin_class,
38
- schema: lambda do
39
- required(:value).filled :str?
40
- end
41
- )
42
- end
43
- end
@@ -1,42 +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 "forwardable"
18
- require "kitchen"
19
- require "terraform"
20
- require "terraform/debug_logger"
21
- require "terraform/project_version"
22
-
23
- # Miscellaneous behaviour for objects that extend ::Kitchen::Configurable.
24
- module ::Terraform::Configurable
25
- extend ::Forwardable
26
-
27
- def_delegator :config, :[]=
28
-
29
- def_delegators :instance, :driver, :provisioner, :transport
30
-
31
- def self.included(configurable_class)
32
- configurable_class.plugin_version ::Terraform::PROJECT_VERSION
33
- end
34
-
35
- def debug_logger
36
- @debug_logger ||= ::Terraform::DebugLogger.new logger: logger
37
- end
38
-
39
- def instance_pathname(filename:)
40
- ::File.join config.fetch(:kitchen_root), ".kitchen", "kitchen-terraform", instance.name, filename
41
- end
42
- end