kitchen-terraform 3.3.1 → 4.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.
Files changed (36) 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 +45 -28
  5. data/lib/kitchen/driver/terraform.rb +87 -66
  6. data/lib/kitchen/provisioner/terraform.rb +1 -1
  7. data/lib/kitchen/terraform/client_version_verifier.rb +3 -3
  8. data/lib/kitchen/terraform/command/output.rb +43 -40
  9. data/lib/kitchen/{verifier/terraform/configure_inspec_runner_host.rb → terraform/config_attribute/systems.rb} +18 -11
  10. data/lib/kitchen/terraform/config_attribute/variable_files.rb +1 -1
  11. data/lib/kitchen/terraform/config_schemas/system.rb +555 -0
  12. data/lib/kitchen/terraform/{breaking/kitchen_instance.rb → config_schemas/systems.rb} +16 -5
  13. data/lib/kitchen/terraform/configurable.rb +2 -6
  14. data/lib/kitchen/terraform/inspec.rb +74 -0
  15. data/lib/kitchen/terraform/inspec_options_mapper.rb +49 -0
  16. data/lib/kitchen/terraform/inspec_with_hosts.rb +49 -0
  17. data/lib/kitchen/terraform/inspec_without_hosts.rb +44 -0
  18. data/lib/kitchen/terraform/shell_out.rb +13 -10
  19. data/lib/kitchen/terraform/system.rb +120 -0
  20. data/lib/kitchen/terraform/system_attrs_resolver.rb +57 -0
  21. data/lib/kitchen/terraform/system_hosts_resolver.rb +45 -0
  22. data/lib/kitchen/terraform/version.rb +60 -17
  23. data/lib/kitchen/verifier/terraform.rb +162 -156
  24. metadata +45 -41
  25. metadata.gz.sig +0 -0
  26. data/lib/kitchen/terraform/config_attribute/groups.rb +0 -148
  27. data/lib/kitchen/terraform/config_schemas/groups.rb +0 -52
  28. data/lib/kitchen/terraform/deprecating/kitchen_instance.rb +0 -61
  29. data/lib/kitchen/terraform/kitchen_instance.rb +0 -49
  30. data/lib/kitchen/verifier/terraform/configure_inspec_runner_attributes.rb +0 -98
  31. data/lib/kitchen/verifier/terraform/configure_inspec_runner_backend.rb +0 -32
  32. data/lib/kitchen/verifier/terraform/configure_inspec_runner_controls.rb +0 -41
  33. data/lib/kitchen/verifier/terraform/configure_inspec_runner_port.rb +0 -40
  34. data/lib/kitchen/verifier/terraform/configure_inspec_runner_ssh_key.rb +0 -41
  35. data/lib/kitchen/verifier/terraform/configure_inspec_runner_user.rb +0 -40
  36. data/lib/kitchen/verifier/terraform/enumerate_groups_and_hostnames.rb +0 -82
@@ -98,7 +98,7 @@ class ::Kitchen::Provisioner::Terraform < ::Kitchen::Provisioner::Base
98
98
  .apply do |output:|
99
99
  state
100
100
  .store(
101
- :kitchen_terraform_output,
101
+ :kitchen_terraform_outputs,
102
102
  output
103
103
  )
104
104
  end
@@ -20,7 +20,7 @@ require "rubygems"
20
20
 
21
21
  # Verifies that the output of the Terraform version command indicates a supported version of Terraform.
22
22
  #
23
- # Supported:: Terraform version >= 0.10.2, < 0.12.0.
23
+ # Supported:: Terraform version >= 0.11.4, < 0.12.0.
24
24
  class ::Kitchen::Terraform::ClientVersionVerifier
25
25
  # Verifies output from the Terraform version command against the support version.
26
26
  #
@@ -41,7 +41,7 @@ class ::Kitchen::Terraform::ClientVersionVerifier
41
41
  .satisfied_by? version or
42
42
  raise(
43
43
  ::Kitchen::Terraform::Error,
44
- "Terraform v#{version} is not supported; install Terraform ~> v0.11.0"
44
+ "Terraform v#{version} is not supported; install Terraform ~> v0.11.4"
45
45
  )
46
46
 
47
47
  return "Terraform v#{version} is supported"
@@ -57,7 +57,7 @@ class ::Kitchen::Terraform::ClientVersionVerifier
57
57
  @requirement =
58
58
  ::Gem::Requirement
59
59
  .new(
60
- ">= 0.10.2",
60
+ ">= 0.11.4",
61
61
  "< 0.12.0"
62
62
  )
63
63
  end
@@ -21,51 +21,54 @@ require "kitchen/terraform/shell_out"
21
21
 
22
22
  # Behaviour to run the `terraform output` command.
23
23
  module ::Kitchen::Terraform::Command::Output
24
- # Runs the command with JSON foramtting.
25
- #
26
- # @param duration [::Integer] the maximum duration in seconds to run the command.
27
- # @param logger [::Kitchen::Logger] a Test Kitchen logger to capture the output from running the command.
28
- # @yieldparam output [::String] the standard output of the command parsed as JSON.
29
- def self.run(duration:, logger:, &block)
30
- run_shell_out(
31
- duration: duration,
32
- logger: logger,
33
- &block
34
- )
35
- rescue ::JSON::ParserError => error
36
- handle_json_parser error: error
37
- rescue ::Kitchen::Terraform::Error => error
38
- handle_kitchen_terraform(
39
- error: error,
40
- &block
41
- )
42
- end
24
+ class << self
25
+ # Runs the command with JSON foramtting.
26
+ #
27
+ # @option options [::String] :cwd the directory in which to run the command.
28
+ # @option options [::Kitchen::Logger] :live_stream a Test Kitchen logger to capture the output from running the
29
+ # command.
30
+ # @option options [::Integer] :timeout the maximum duration in seconds to run the command.
31
+ # @param options [::Hash] options which adjust the execution of the command.
32
+ # @yieldparam output [::String] the standard output of the command parsed as JSON.
33
+ def run(options:, &block)
34
+ run_shell_out(
35
+ options: options,
36
+ &block
37
+ )
38
+ rescue ::JSON::ParserError => error
39
+ handle_json_parser error: error
40
+ rescue ::Kitchen::Terraform::Error => error
41
+ handle_kitchen_terraform(
42
+ error: error,
43
+ &block
44
+ )
45
+ end
43
46
 
44
- private_class_method
47
+ private
45
48
 
46
- # @api private
47
- def self.handle_json_parser(error:)
48
- raise(
49
- ::Kitchen::Terraform::Error,
50
- "Parsing Terraform output as JSON failed: #{error.message}"
51
- )
52
- end
49
+ # @api private
50
+ def handle_json_parser(error:)
51
+ raise(
52
+ ::Kitchen::Terraform::Error,
53
+ "Parsing Terraform output as JSON failed: #{error.message}"
54
+ )
55
+ end
53
56
 
54
- # @api private
55
- def self.handle_kitchen_terraform(error:)
56
- /no\\ outputs\\ defined/.match ::Regexp.escape error.to_s or raise error
57
- yield output: {}
58
- end
57
+ # @api private
58
+ def handle_kitchen_terraform(error:)
59
+ /no\\ outputs\\ defined/.match ::Regexp.escape error.to_s or raise error
60
+ yield output: {}
61
+ end
59
62
 
60
- # @api private
61
- def self.run_shell_out(duration:, logger:)
62
- ::Kitchen::Terraform::ShellOut
63
- .run(
64
- command: "output -json",
65
- duration: duration,
66
- logger: logger
67
- ) do |standard_output:|
63
+ # @api private
64
+ def run_shell_out(options:)
65
+ ::Kitchen::Terraform::ShellOut
66
+ .run(
67
+ command: "output -json",
68
+ options: options,
69
+ ) do |standard_output:|
68
70
  yield output: ::JSON.parse(standard_output)
69
71
  end
72
+ end
70
73
  end
71
74
  end
@@ -14,17 +14,24 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "kitchen/verifier/terraform"
17
+ require "kitchen/terraform/config_attribute"
18
+ require "kitchen/terraform/config_schemas/systems"
18
19
 
19
- # Configures the host for the Inspec::Runner used by the verifier to verify a group's host.
20
- #
21
- # @see https://github.com/chef/inspec/blob/master/lib/inspec/runner.rb Inspec::Runner
22
- module ::Kitchen::Verifier::Terraform::ConfigureInspecRunnerHost
23
- # Invokes the function.
24
- #
25
- # @param hostname [::String] the hostname of a group's host.
26
- # @param options [::Hash] the Inspec::Runner's options.
27
- def self.call(hostname:, options:)
28
- options.store "host", hostname
20
+ module Kitchen
21
+ module Terraform
22
+ class ConfigAttribute
23
+ # {include:Kitchen::Terraform::ConfigSchemas::Systems}
24
+ #
25
+ # If the +systems+ key is omitted then no tests will be executed.
26
+ module Systems
27
+ ::Kitchen::Terraform::ConfigAttribute.new(
28
+ attribute: :systems,
29
+ default_value: lambda do
30
+ []
31
+ end,
32
+ schema: ::Kitchen::Terraform::ConfigSchemas::Systems,
33
+ ).apply config_attribute: self
34
+ end
35
+ end
29
36
  end
30
37
  end
@@ -22,7 +22,7 @@ require "kitchen/terraform/file_path_config_attribute_definer"
22
22
  # This attribute comprises paths to
23
23
  # {https://www.terraform.io/docs/configuration/variables.html#variable-files Terraform variable files}.
24
24
  #
25
- # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760118 Sequince of scalars}
25
+ # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760118 Sequence of scalars}
26
26
  # Required:: False
27
27
  # Example::
28
28
  # _
@@ -0,0 +1,555 @@
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/terraform/config_schemas"
19
+
20
+ module Kitchen
21
+ module Terraform
22
+ module ConfigSchemas
23
+ # A system is a mapping which is used to configure the execution of {https://www.inspec.io/docs/ InSpec tests}
24
+ # against a system in the Terraform state.
25
+ #
26
+ # All systems within the same {https://kitchen.ci/docs/getting-started/adding-suite Kitchen suite} are tested
27
+ # using the same {https://www.inspec.io/docs/reference/profiles/ InSpec profile}. The profile must be implemented
28
+ # in the directory located at `<Kitchen root>/test/integration/<suite name>`.
29
+ #
30
+ # The values of all {https://www.terraform.io/docs/configuration/outputs.html Terraform outputs} are associated
31
+ # with equivalently named
32
+ # {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes}.
33
+ #
34
+ # The keys of a system mapping correlate to the options of the
35
+ # {https://www.inspec.io/docs/reference/cli/#exec +inspec exec+} command-line interface subcomamand.
36
+ #
37
+ # ===== Required Keys
38
+ #
39
+ # The following keys must be included by every system.
40
+ #
41
+ # ====== name
42
+ #
43
+ # The value of the +name+ key is a scalar which is used to refer to the system for logging purposes.
44
+ #
45
+ # <em>Example kitchen.yml</em>
46
+ # verifier:
47
+ # name: terraform
48
+ # systems:
49
+ # - name: a system
50
+ # backend: local
51
+ #
52
+ # ====== backend
53
+ #
54
+ # The value of the +backend+ key is a scalar which is used to select the
55
+ # {https://www.inspec.io/docs/reference/cli/#exec InSpec backend} for connections to the system.
56
+ #
57
+ # The scalar must match the name of one the available backends.
58
+ #
59
+ # <em>Example kitchen.yml</em>
60
+ # verifier:
61
+ # name: terraform
62
+ # systems:
63
+ # - name: a system
64
+ # backend: docker
65
+ #
66
+ # ===== Optional Keys
67
+ #
68
+ # The following keys may be included by any system to alter the behaviour of InSpec. Any key which is omitted
69
+ # will be associated with a default value as defined by InSpec.
70
+ #
71
+ # ====== attrs
72
+ #
73
+ # The value of the +attrs+ key is a sequence of scalars which is used to locate any
74
+ # {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes} files.
75
+ #
76
+ # <em>Example kitchen.yml</em>
77
+ # verifier:
78
+ # name: terraform
79
+ # systems:
80
+ # - name: a system
81
+ # backend: local
82
+ # attrs:
83
+ # - /path/to/first_attributes.yml
84
+ # - /path/to/second_attributes.yml
85
+ #
86
+ # ====== attrs_outputs
87
+ #
88
+ # The value of the +attrs_outputs+ key is a mapping of scalars to scalars which is used to define
89
+ # {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes} with the values
90
+ # of Terraform outputs.
91
+ #
92
+ # The use of the +attrs_outputs+ key is only necessary to override the default definitions of profile attributes
93
+ # with names and values equivalent to the outputs.
94
+ #
95
+ # <em>Example kitchen.yml</em>
96
+ # verifier:
97
+ # name: terraform
98
+ # systems:
99
+ # - name: a system
100
+ # backend: local
101
+ # attrs_outputs:
102
+ # an_attribute_name: an_output_name
103
+ #
104
+ # ====== backend_cache
105
+ #
106
+ # The value of the +backend_cache+ key is a boolean which is used to toggle the caching of InSpec backend command
107
+ # output.
108
+ #
109
+ # <em>Example kitchen.yml</em>
110
+ # verifier:
111
+ # name: terraform
112
+ # systems:
113
+ # - name: a system
114
+ # backend: local
115
+ # backend_cache: false
116
+ #
117
+ # ====== bastion_host
118
+ #
119
+ # The value of the +bastion_host+ key is a scalar which is used as the hostname of a
120
+ # {https://en.wikipedia.org/wiki/Bastion_host bastion host} to connect to before connecting to hosts in the
121
+ # system.
122
+ #
123
+ # The +bastion_host+ key must be used in combination with a backend which supports remote connections.
124
+ #
125
+ # <em>Example kitchen.yml</em>
126
+ # verifier:
127
+ # name: terraform
128
+ # systems:
129
+ # - name: a system
130
+ # backend: ssh
131
+ # bastion_host: bastion-host.domain
132
+ #
133
+ # ====== bastion_port
134
+ #
135
+ # The value of the +bastion_port+ key is an integer which is used as the port number to connect to on the bastion
136
+ # host.
137
+ #
138
+ # The +bastion_port+ key must be used in combination with the +bastion_host+ key.
139
+ #
140
+ # <em>Example kitchen.yml</em>
141
+ # verifier:
142
+ # name: terraform
143
+ # systems:
144
+ # - name: a system
145
+ # backend: ssh
146
+ # bastion_host: bastion-host.domain
147
+ # bastion_port: 1234
148
+ #
149
+ # ====== bastion_user
150
+ #
151
+ # The value of the +bastion_user+ key is a scalar which is used as the username for authentication with the
152
+ # bastion host.
153
+ #
154
+ # The +bastion_user+ key must be used in combination with the +bastion_host+ key.
155
+ #
156
+ # <em>Example kitchen.yml</em>
157
+ # verifier:
158
+ # name: terraform
159
+ # systems:
160
+ # - name: a system
161
+ # backend: ssh
162
+ # bastion_host: bastion-host.domain
163
+ # bastion_user: bastion-user
164
+ #
165
+ # ====== controls
166
+ #
167
+ # The value of the +controls+ key is a sequence of scalars which is used to select for execution against the
168
+ # system a subset of the {https://www.inspec.io/docs/reference/dsl_inspec/ InSpec controls} of the profile.
169
+ #
170
+ # The use of the +controls+ key is only necessary if the system should not be tested with all of the controls of # the profile.
171
+ #
172
+ # The scalars must match the names of the controls, not the names of the control files.
173
+ #
174
+ # <em>Example kitchen.yml</em>
175
+ # verifier:
176
+ # name: terraform
177
+ # systems:
178
+ # - name: first system
179
+ # backend: local
180
+ # controls:
181
+ # - first control
182
+ # - third control
183
+ # - name: second system
184
+ # backend: local
185
+ # controls:
186
+ # - second control
187
+ # - fourth control
188
+ #
189
+ # ====== enable_password
190
+ #
191
+ # The value of the +enable_password+ key is a scalar which is used as the password for authentication with a
192
+ # Cisco IOS device in enable mode.
193
+ #
194
+ # The +enable_password+ key must be used in combination with +backend: ssh+.
195
+ #
196
+ # <em>Example kitchen.yml</em>
197
+ # verifier:
198
+ # name: terraform
199
+ # systems:
200
+ # - name: a system
201
+ # backend: ssh
202
+ # enable_password: Cisc0!
203
+ #
204
+ # ====== hosts
205
+ #
206
+ # The value of the +hosts+ key is a sequence of scalars which is used as addresses of hosts in the system.
207
+ #
208
+ # The +hosts+ key must be used in combination with a backend which enables remote connections.
209
+ #
210
+ # <em>Example kitchen.yml</em>
211
+ # verifier:
212
+ # name: terraform
213
+ # systems:
214
+ # - name: a system
215
+ # backend: ssh
216
+ # hosts:
217
+ # - hostname.domainname
218
+ #
219
+ # ====== hosts_output
220
+ #
221
+ # The value of the +hosts_output+ key is a scalar which is used to obtain the addresses of hosts in the system
222
+ # from a Terraform output.
223
+ #
224
+ # The scalar must match the name of an output with a value which is a string or an array of strings.
225
+ #
226
+ # The +hosts_output+ key must be used in combination with a backend which enables remote connections.
227
+ #
228
+ # <em>Example kitchen.yml</em>
229
+ # verifier:
230
+ # name: terraform
231
+ # systems:
232
+ # - name: a system
233
+ # backend: ssh
234
+ # hosts_output: an_output
235
+ #
236
+ # ====== key_files
237
+ #
238
+ # The value of the +key_files+ key is a sequence of scalars which is used to locate key files (also known as
239
+ # identity files) for {https://linux.die.net/man/1/ssh Secure Shell (SSH) authentication} with hosts in the
240
+ # Terraform state.
241
+ #
242
+ # The +key_files+ key must be used in combination with +backend: ssh+.
243
+ #
244
+ # <em>Example kitchen.yml</em>
245
+ # verifier:
246
+ # name: terraform
247
+ # systems:
248
+ # - name: a system
249
+ # backend: ssh
250
+ # key_files:
251
+ # - /path/to/first/key/file
252
+ # - /path/to/second/key/file
253
+ #
254
+ # ====== password
255
+ #
256
+ # The value of the +password+ key is a scalar which is used as the password for authentication with hosts in the
257
+ # system.
258
+ #
259
+ # The +password+ key must be used in combination with a backend which supports password authentication.
260
+ #
261
+ # <em>Example kitchen.yml</em>
262
+ # verifier:
263
+ # name: terraform
264
+ # systems:
265
+ # - name: a system
266
+ # backend: ssh
267
+ # password: Th3P455I5Th3W0rd
268
+ #
269
+ # ====== path
270
+ #
271
+ # The value of the +path+ key is a scalar which is used as the login path when connecting to a host in the system.
272
+ #
273
+ # The +path+ key must be used in combination with +backend: winrm+.
274
+ #
275
+ # <em>Example kitchen.yml</em>
276
+ # verifier:
277
+ # name: terraform
278
+ # systems:
279
+ # - name: a system
280
+ # backend: winrm
281
+ # path: /login
282
+ #
283
+ # ====== port
284
+ #
285
+ # The value of the +port+ key is an integer which is used as the port number when connecting via SSH to the hosts
286
+ # of the system.
287
+ #
288
+ # The +port+ key must be used in combination with +backend: ssh+.
289
+ #
290
+ # If the +port+ key is omitted then the value of the +port+ key of the Test Kitchen transport will be used.
291
+ #
292
+ # <em>Example kitchen.yml</em>
293
+ # verifier:
294
+ # name: terraform
295
+ # systems:
296
+ # - name: a system
297
+ # backend: ssh
298
+ # port: 1234
299
+ #
300
+ # ====== proxy_command
301
+ #
302
+ # The value of the +proxy_command+ key is a scalar which is used as a proxy command when connecting to a host via
303
+ # SSH.
304
+ #
305
+ # The +proxy_command+ key must be used in combination with +backend: ssh+.
306
+ #
307
+ # <em>Example kitchen.yml</em>
308
+ # verifier:
309
+ # name: terraform
310
+ # systems:
311
+ # - name: a system
312
+ # backend: ssh
313
+ # proxy_command: ssh root@127.0.0.1 -W %h:%p
314
+ #
315
+ # ====== reporter
316
+ #
317
+ # The value of the +reporter+ key is a sequence of scalars which is used to select the
318
+ # {https://www.inspec.io/docs/reference/reporters/#supported-reporters InSpec reporters}
319
+ # for reporting test output.
320
+ #
321
+ # The scalars must match the names of the available reporters.
322
+ #
323
+ # <em>Example kitchen.yml</em>
324
+ # verifier:
325
+ # name: terraform
326
+ # systems:
327
+ # - name: a system
328
+ # backend: local
329
+ # reporter:
330
+ # - cli
331
+ # - documentation
332
+ #
333
+ # ====== self_signed
334
+ #
335
+ # The value of the +self_signed+ key is a boolean which is used to toggle permission for self-signed certificates
336
+ # during testing of Windows hosts.
337
+ #
338
+ # The +self_signed+ key must be used in combination with +backend: winrm+.
339
+ #
340
+ # <em>Example kitchen.yml</em>
341
+ # verifier:
342
+ # name: terraform
343
+ # systems:
344
+ # - name: a system
345
+ # backend: winrm
346
+ # self_signed: true
347
+ #
348
+ # ====== shell
349
+ #
350
+ # The value of the +shell+ key is a boolean which is used to toggle the use of a subshell when executing tests on
351
+ # hosts in the system.
352
+ #
353
+ # The +shell+ key is only effective for a system which has Unix-like hosts.
354
+ #
355
+ # <em>Example kitchen.yml</em>
356
+ # verifier:
357
+ # name: terraform
358
+ # systems:
359
+ # - name: a system
360
+ # backend: ssh
361
+ # hosts_output: an_output
362
+ # shell: true
363
+ #
364
+ # ====== shell_command
365
+ #
366
+ # The value of the +shell_command+ key is a scalar which is used to override the default shell command used to
367
+ # instantiate a subshell.
368
+ #
369
+ # The +shell_command+ key must be used in combination with +shell: true+.
370
+ #
371
+ # <em>Example kitchen.yml</em>
372
+ # verifier:
373
+ # name: terraform
374
+ # systems:
375
+ # - name: a system
376
+ # backend: ssh
377
+ # hosts_output: an_output
378
+ # shell: true
379
+ # shell_command: /bin/ksh
380
+ #
381
+ # ====== shell_options
382
+ #
383
+ # The value of the +shell_options+ key is a scalar which is used to provide options to the subshell.
384
+ #
385
+ # The +shell_options+ key must be used in combination with +shell: true+.
386
+ #
387
+ # <em>Example kitchen.yml</em>
388
+ # verifier:
389
+ # name: terraform
390
+ # systems:
391
+ # - name: a system
392
+ # backend: ssh
393
+ # hosts_output: an_output
394
+ # shell: true
395
+ # shell_options: -v
396
+ #
397
+ # ====== show_progress
398
+ #
399
+ # The value of the +show_progress+ key is a boolean which is used to toggle the display of progress while tests
400
+ # are executing.
401
+ #
402
+ # <em>Example kitchen.yml</em>
403
+ # verifier:
404
+ # name: terraform
405
+ # systems:
406
+ # - name: a system
407
+ # backend: local
408
+ # show_progress: false
409
+ #
410
+ # ====== ssl
411
+ #
412
+ # The value of the +ssl+ key is a boolean which is used to toggle the use of
413
+ # {https://en.wikipedia.org/wiki/Transport_Layer_Security Transport Layer Security (TLS)} when connecting to
414
+ # hosts in the system. InSpec's reference to Secure Socket Layer (SSL) is a misnomer as that protocol has been
415
+ # deprecated in favour of TLS.
416
+ #
417
+ # The +ssl+ key must be used in combination with +backend: winrm+.
418
+ #
419
+ # <em>Example kitchen.yml</em>
420
+ # verifier:
421
+ # name: terraform
422
+ # systems:
423
+ # - name: a system
424
+ # backend: winrm
425
+ # ssl: true
426
+ #
427
+ # ====== sudo
428
+ #
429
+ # The value of the +sudo+ key is a boolean which is used to toggle the use of
430
+ # {https://en.wikipedia.org/wiki/Sudo sudo} for obtaining superuser permissions when executing tests on hosts in
431
+ # the system.
432
+ #
433
+ # The +sudo+ key is only effective for a system which has Unix-like hosts.
434
+ #
435
+ # <em>Example kitchen.yml</em>
436
+ # verifier:
437
+ # name: terraform
438
+ # systems:
439
+ # - name: a system
440
+ # backend: ssh
441
+ # hosts_output: an_output
442
+ # sudo: true
443
+ #
444
+ # ====== sudo_command
445
+ #
446
+ # The value of the +sudo_command+ key is a scalar which is used to override the default command used to
447
+ # invoke sudo.
448
+ #
449
+ # The +sudo_command+ key must be used in combination with +sudo: true+.
450
+ #
451
+ # <em>Example kitchen.yml</em>
452
+ # verifier:
453
+ # name: terraform
454
+ # systems:
455
+ # - name: a system
456
+ # backend: ssh
457
+ # hosts_output: an_output
458
+ # sudo: true
459
+ # sudo_command: /bin/sudo
460
+ #
461
+ # ====== sudo_options
462
+ #
463
+ # The value of the +sudo_options+ key is a scalar which is used to provide options to the sudo command.
464
+ #
465
+ # The +sudo_options+ key must be used in combination with +sudo: true+.
466
+ #
467
+ # <em>Example kitchen.yml</em>
468
+ # verifier:
469
+ # name: terraform
470
+ # systems:
471
+ # - name: a system
472
+ # backend: ssh
473
+ # hosts_output: an_output
474
+ # sudo: true
475
+ # sudo_options: -u admin
476
+ #
477
+ # ====== sudo_password
478
+ #
479
+ # The value of the +sudo_password+ key is a scalar which is used as the password for authentication with the sudo
480
+ # command.
481
+ #
482
+ # The +sudo_password+ key must be used in combination with +sudo: true+.
483
+ #
484
+ # <em>Example kitchen.yml</em>
485
+ # verifier:
486
+ # name: terraform
487
+ # systems:
488
+ # - name: a system
489
+ # backend: ssh
490
+ # hosts_output: an_output
491
+ # sudo: true
492
+ # sudo_password: Th3P455I5Th3W0rd
493
+ #
494
+ # ====== user
495
+ #
496
+ # The value of the +user+ key is a scalar which is used as the username for authentication with hosts in the
497
+ # system.
498
+ #
499
+ # The +user+ key must be used in combination with a backend which supports user authentication.
500
+ #
501
+ # <em>Example kitchen.yml</em>
502
+ # verifier:
503
+ # name: terraform
504
+ # systems:
505
+ # - name: a system
506
+ # backend: ssh
507
+ # user: tester
508
+ #
509
+ # ====== vendor_cache
510
+ #
511
+ # The value of the +vendor_cache+ key is a scalar which is used as the pathname of the directory in which InSpec
512
+ # will cache dependencies of the profile.
513
+ #
514
+ # <em>Example kitchen.yml</em>
515
+ # verifier:
516
+ # name: terraform
517
+ # systems:
518
+ # - name: a system
519
+ # backend: local
520
+ # vendor_cache: /opt/inspec-cache
521
+ System = ::Dry::Validation.Params do
522
+ required(:name).filled :str?
523
+ required(:backend).filled :str?
524
+ optional(:attrs).each(:filled?, :str?)
525
+ optional(:attrs_outputs).filled :hash?
526
+ optional(:backend_cache).value :bool?
527
+ optional(:bastion_host).filled :str?
528
+ optional(:bastion_port).value :int?
529
+ optional(:bastion_user).filled :str?
530
+ optional(:controls).each(:filled?, :str?)
531
+ optional(:enable_password).filled :str?
532
+ optional(:hosts).each :filled?, :str?
533
+ optional(:hosts_output).filled :str?
534
+ optional(:key_files).each(:filled?, :str?)
535
+ optional(:password).filled :str?
536
+ optional(:path).filled :str?
537
+ optional(:port).value :int?
538
+ optional(:proxy_command).filled :str?
539
+ optional(:reporter).each(:filled?, :str?)
540
+ optional(:self_signed).value :bool?
541
+ optional(:shell).value :bool?
542
+ optional(:shell_command).filled :str?
543
+ optional(:shell_options).filled :str?
544
+ optional(:show_progress).value :bool?
545
+ optional(:ssl).value :bool?
546
+ optional(:sudo).value :bool?
547
+ optional(:sudo_command).filled :str?
548
+ optional(:sudo_options).filled :str?
549
+ optional(:sudo_password).filled :str?
550
+ optional(:user).filled :str?
551
+ optional(:vendor_cache).filled :str?
552
+ end
553
+ end
554
+ end
555
+ end