kitchen-terraform 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf0dc03c57101fc1ec8ea5a7910687185af00612
4
- data.tar.gz: e0388efadde2ab8ee75d2cd47289c9d96a910e74
3
+ metadata.gz: 9c484cfa1fce45ee648ee3e184937331b74e2d92
4
+ data.tar.gz: 6feb2f68cf8e842426720b8a4f5b036243529e9f
5
5
  SHA512:
6
- metadata.gz: 64d24a44a89f19009e8d9e32882688d6d9d9e02490d9a2755cec8ff0e9f098be0aa8000a5da35516833bd561ae4599162bce62065faa38e2ac888f8126bc85ee
7
- data.tar.gz: 26382da8eca826218c70450749969b7c734fbea01e32d8b0ab19ac6a2bae8b713582ee3b6641a45347f2d0ba3b2e254bf7c636d201d87c8136c10b7dae88b95f
6
+ metadata.gz: 2add7730329949a50da2911e2fd05868f67c7a2dab984aa68343f49c2bfd956a23174378907801bca3a17fc597dda7eebfb9344fbc4bbb3c55d0d5e5e1c1fa6e
7
+ data.tar.gz: e67c2f15793a4a0dde35df3b24228228fec45af008b3d202d96cc294c365b8d4e079fc544af00d6a1b6ceab0ec9cbefc6270c8996586854ac0b5b2a2dd5faa97
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -17,7 +17,7 @@
17
17
  require "kitchen/terraform/config_attribute"
18
18
  require "kitchen/terraform/config_attribute_cacher"
19
19
  require "kitchen/terraform/config_attribute_definer"
20
- require "kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings"
20
+ require "kitchen/terraform/config_schemas/groups"
21
21
 
22
22
  # The +:groups+ configuration attribute is an optional array including hashes comprising properties to manage the
23
23
  # execution of InSpec profiles against different resources in the Terraform state.
@@ -51,14 +51,21 @@ require "kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings
51
51
  #
52
52
  # ==== port
53
53
  #
54
- # An optional integer which represents the port to use when connecting to the hosts of the group with Secure Shell
55
- # (SSH).
54
+ # An optional integer which represents the port to use when connecting with Secure Shell (SSH) to the hosts of the
55
+ # group.
56
56
  #
57
57
  # If this key is omitted then the port of the Test Kitchen SSH Transport will be used.
58
58
  #
59
+ # ==== ssh_key
60
+ #
61
+ # An optional string which contains the path to the private SSH key to use when connecting with SSH to the hosts of the
62
+ # group.
63
+ #
64
+ # If this key is omitted then the private SSH key of the Test Kitchen SSH Transport will be used.
65
+ #
59
66
  # ==== username
60
67
  #
61
- # An optional string which contains the username to use when connecting to the hosts of the group with SSH.
68
+ # An optional string which contains the username to use when connecting with SSH to the hosts of the group.
62
69
  #
63
70
  # If this key is omitted then the username of the Test Kitcen SSH Transport will be used.
64
71
  #
@@ -77,7 +84,7 @@ module ::Kitchen::Terraform::ConfigAttribute::Groups
77
84
  ::Kitchen::Terraform::ConfigAttributeDefiner
78
85
  .new(
79
86
  attribute: self,
80
- schema: ::Kitchen::Terraform::ConfigSchemas::ArrayOfHashesOfSymbolsAndStrings
87
+ schema: ::Kitchen::Terraform::ConfigSchemas::Groups
81
88
  )
82
89
  .define plugin_class: plugin_class
83
90
  end
@@ -18,11 +18,11 @@ require "dry-validation"
18
18
  require "kitchen/terraform/config_predicates/hash_of_symbols_and_strings"
19
19
  require "kitchen/terraform/config_schemas"
20
20
 
21
- # A validation schema for a configuration attribute which is an array of hashes including only symbol keys and string
22
- # values.
21
+ # A validation schema for the groups configuration attribute which is an array of hashes including only symbol keys and
22
+ # string values.
23
23
  #
24
24
  # @see http://dry-rb.org/gems/dry-validation/basics/working-with-schemas/ DRY Validation Working With Schemas
25
- ::Kitchen::Terraform::ConfigSchemas::ArrayOfHashesOfSymbolsAndStrings =
25
+ ::Kitchen::Terraform::ConfigSchemas::Groups =
26
26
  ::Dry::Validation
27
27
  .Schema do
28
28
  configure do
@@ -41,6 +41,11 @@ require "kitchen/terraform/config_schemas"
41
41
  )
42
42
  optional(:hostnames).value :str?
43
43
  optional(:port).value :int?
44
+ optional(:ssh_key)
45
+ .maybe(
46
+ :str?,
47
+ :filled?
48
+ )
44
49
  optional(:username).value :str?
45
50
  end
46
51
  end
@@ -16,4 +16,5 @@
16
16
 
17
17
  require "kitchen/terraform"
18
18
 
19
- ::Kitchen::Terraform::VERSION = "2.0.0".freeze
19
+ # The version of the kitchen-terraform gem.
20
+ ::Kitchen::Terraform::VERSION = "2.1.0".freeze
@@ -109,6 +109,12 @@ class ::Kitchen::Verifier::Terraform < ::Kitchen::Verifier::Inspec
109
109
  self.class::ConfigureInspecRunnerBackend.call hostname: state.fetch(:hostname), options: options
110
110
  self.class::ConfigureInspecRunnerHost.call hostname: state.fetch(:hostname), options: options
111
111
  self.class::ConfigureInspecRunnerPort.call group: state.fetch(:group), options: options
112
+ self
113
+ .class::ConfigureInspecRunnerSSHKey
114
+ .call(
115
+ group: state.fetch(:group),
116
+ options: options
117
+ )
112
118
  self.class::ConfigureInspecRunnerUser.call group: state.fetch(:group), options: options
113
119
  self.class::ConfigureInspecRunnerAttributes
114
120
  .call(driver: driver, group: state.fetch(:group), terraform_state: driver[:state]).bind do |attributes|
@@ -124,5 +130,6 @@ require "kitchen/verifier/terraform/configure_inspec_runner_backend"
124
130
  require "kitchen/verifier/terraform/configure_inspec_runner_controls"
125
131
  require "kitchen/verifier/terraform/configure_inspec_runner_host"
126
132
  require "kitchen/verifier/terraform/configure_inspec_runner_port"
133
+ require "kitchen/verifier/terraform/configure_inspec_runner_ssh_key"
127
134
  require "kitchen/verifier/terraform/configure_inspec_runner_user"
128
135
  require "kitchen/verifier/terraform/enumerate_groups_and_hostnames"
@@ -0,0 +1,43 @@
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/verifier/terraform"
19
+
20
+ # Configures the private SSH key to be used by the verifier's InSpec Runner to verify a group.
21
+ #
22
+ # The default value is the Test Kitchen SSH Transport's +:ssh_key+ configuration attribute.
23
+ #
24
+ # @see https://github.com/chef/inspec/blob/master/lib/inspec/runner.rb InSpec Runner
25
+ # @see https://github.com/test-kitchen/test-kitchen/blob/v1.16.0/lib/kitchen/transport/ssh.rb Test Kitchen SSH Transport
26
+ module ::Kitchen::Verifier::Terraform::ConfigureInspecRunnerSSHKey
27
+ extend ::Dry::Monads::Maybe::Mixin
28
+
29
+ # Invoke the function.
30
+ #
31
+ # @param group [::Hash] the group being verified.
32
+ # @param options [::Hash] the Inspec::Runner's options.
33
+ def self.call(group:, options:)
34
+ Maybe(group[:ssh_key])
35
+ .bind do |ssh_key|
36
+ options
37
+ .store(
38
+ "key_files",
39
+ [ssh_key]
40
+ )
41
+ end
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Lane
@@ -54,7 +54,7 @@ cert_chain:
54
54
  XjOfZudLs1zJ8ZNOuwj6KkGJ9J3XHd9hM95MtBEWlxAfYdCuW1+v7zCTfbieBEba
55
55
  UIyyldg4TuVcuRs8uKJyempT0hqx2DniseBWw3nvtgom3A==
56
56
  -----END CERTIFICATE-----
57
- date: 2017-09-14 00:00:00.000000000 Z
57
+ date: 2017-10-11 00:00:00.000000000 Z
58
58
  dependencies:
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: codeclimate-test-reporter
@@ -315,9 +315,9 @@ files:
315
315
  - lib/kitchen/terraform/config_predicates.rb
316
316
  - lib/kitchen/terraform/config_predicates/hash_of_symbols_and_strings.rb
317
317
  - lib/kitchen/terraform/config_schemas.rb
318
- - lib/kitchen/terraform/config_schemas/array_of_hashes_of_symbols_and_strings.rb
319
318
  - lib/kitchen/terraform/config_schemas/array_of_strings.rb
320
319
  - lib/kitchen/terraform/config_schemas/boolean.rb
320
+ - lib/kitchen/terraform/config_schemas/groups.rb
321
321
  - lib/kitchen/terraform/config_schemas/hash_of_symbols_and_strings.rb
322
322
  - lib/kitchen/terraform/config_schemas/integer.rb
323
323
  - lib/kitchen/terraform/config_schemas/optional_string.rb
@@ -332,6 +332,7 @@ files:
332
332
  - lib/kitchen/verifier/terraform/configure_inspec_runner_controls.rb
333
333
  - lib/kitchen/verifier/terraform/configure_inspec_runner_host.rb
334
334
  - lib/kitchen/verifier/terraform/configure_inspec_runner_port.rb
335
+ - lib/kitchen/verifier/terraform/configure_inspec_runner_ssh_key.rb
335
336
  - lib/kitchen/verifier/terraform/configure_inspec_runner_user.rb
336
337
  - lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb
337
338
  homepage: https://github.com/newcontext-oss/kitchen-terraform
@@ -358,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
358
359
  requirements:
359
360
  - Terraform ~> 0.10.2
360
361
  rubyforge_project:
361
- rubygems_version: 2.6.13
362
+ rubygems_version: 2.6.14
362
363
  signing_key:
363
364
  specification_version: 4
364
365
  summary: Test Kitchen plugins for testing Terraform configuration
metadata.gz.sig CHANGED
Binary file