kitchen-terraform 5.7.1 → 6.1.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/README.md +21 -19
- data/lib/kitchen/driver/terraform.rb +1 -1
- data/lib/kitchen/provisioner/terraform.rb +1 -1
- data/lib/kitchen/terraform/breaking.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/post_zero_fifteen_zero.rb +89 -0
- data/lib/kitchen/terraform/command/init/pre_zero_fifteen_zero.rb +101 -0
- data/lib/kitchen/terraform/command/init.rb +3 -80
- data/lib/kitchen/terraform/command/init_factory.rb +52 -0
- data/lib/kitchen/terraform/command/output.rb +1 -1
- data/lib/kitchen/terraform/command/validate/post_zero_fifteen_zero.rb +51 -0
- data/lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb +65 -0
- data/lib/kitchen/terraform/command/validate.rb +3 -41
- data/lib/kitchen/terraform/command/validate_factory.rb +54 -0
- 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.rb +1 -1
- data/lib/kitchen/terraform/command_executor.rb +3 -5
- 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 +2 -2
- 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/command_flag.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.rb +1 -1
- data/lib/kitchen/terraform/config_attribute_cacher.rb +1 -1
- 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_predicates.rb → config_attribute_contract.rb} +3 -3
- data/lib/kitchen/terraform/config_attribute_definer.rb +2 -2
- 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/config_attribute_type.rb +1 -1
- data/lib/kitchen/terraform/configurable.rb +2 -2
- data/lib/kitchen/terraform/debug_logger.rb +1 -1
- data/lib/kitchen/terraform/deprecating.rb +1 -1
- data/lib/kitchen/terraform/driver/create.rb +39 -16
- data/lib/kitchen/terraform/driver/destroy.rb +53 -21
- data/lib/kitchen/terraform/driver.rb +1 -1
- 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/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.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 +5 -4
- 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/converge.rb +52 -25
- data/lib/kitchen/terraform/provisioner.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/raise.rb +1 -1
- data/lib/kitchen/terraform/shell_out.rb +6 -5
- 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/fail_fast.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier/fail_slow.rb +1 -1
- data/lib/kitchen/terraform/systems_verifier.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 +5 -17
- 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.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/supported.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy/unsupported.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy.rb +1 -1
- data/lib/kitchen/terraform/version_verifier_strategy_factory.rb +1 -1
- data/lib/kitchen/terraform.rb +1 -1
- data/lib/kitchen/verifier/terraform.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +65 -62
- 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.
|
|
@@ -15,21 +15,569 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
17
|
require "kitchen/terraform/config_attribute"
|
|
18
|
-
require "kitchen/terraform/
|
|
18
|
+
require "kitchen/terraform/config_attribute_contract/systems"
|
|
19
19
|
|
|
20
20
|
module Kitchen
|
|
21
21
|
module Terraform
|
|
22
22
|
class ConfigAttribute
|
|
23
|
-
#
|
|
23
|
+
# The value of the +systems+ key must be a sequence of systems.
|
|
24
24
|
#
|
|
25
25
|
# If the +systems+ key is omitted then no tests will be executed.
|
|
26
|
+
#
|
|
27
|
+
# A system is a mapping which is used to configure the execution of {https://www.inspec.io/docs/ InSpec tests}
|
|
28
|
+
# against a system in the Terraform state. The keys of a system mapping correlate to the arguments and the
|
|
29
|
+
# options of the {https://www.inspec.io/docs/reference/cli/#exec +inspec exec+} command-line interface
|
|
30
|
+
# subcomamand.
|
|
31
|
+
#
|
|
32
|
+
# ===== InSpec Profiles
|
|
33
|
+
#
|
|
34
|
+
# All systems within the same {https://kitchen.ci/docs/getting-started/adding-suite Kitchen suite} are by default
|
|
35
|
+
# tested using the same {https://www.inspec.io/docs/reference/profiles/ InSpec profile}. The profile must be
|
|
36
|
+
# implemented in the directory located at `<Kitchen root>/test/integration/<suite name>`. This behaviour can be
|
|
37
|
+
# overridden with the <code>profile_locations</code> key.
|
|
38
|
+
#
|
|
39
|
+
# The values of any {https://www.terraform.io/docs/configuration/variables.html Terraform variables} configured
|
|
40
|
+
# with the driver's <code>variables</code> attribute and the values of any
|
|
41
|
+
# {https://www.terraform.io/docs/configuration/outputs.html Terraform outputs} which exist in the Terraform state
|
|
42
|
+
# are associated with equivalently named
|
|
43
|
+
# {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes}, prefixed with
|
|
44
|
+
# <code>input_</code> or <code>output_</code>, respectively. The values of the outputs are also associated with
|
|
45
|
+
# equivalently named profile attributes without any prefixes for backward compatibility. Output associations can
|
|
46
|
+
# be overridden with the <code>attrs_outputs</code> key. For example, the value of a variable named `test` will
|
|
47
|
+
# be associated with an attribute named `input_test`, and the value of an output named `test` will be associated
|
|
48
|
+
# with an attribute named `output_test` as well as an attribute named `test`.
|
|
49
|
+
#
|
|
50
|
+
# ===== Required Keys
|
|
51
|
+
#
|
|
52
|
+
# The following keys must be included by every system.
|
|
53
|
+
#
|
|
54
|
+
# ====== name
|
|
55
|
+
#
|
|
56
|
+
# The value of the +name+ key is a scalar which is used to refer to the system for logging purposes.
|
|
57
|
+
#
|
|
58
|
+
# <em>Example kitchen.yml</em>
|
|
59
|
+
# verifier:
|
|
60
|
+
# name: terraform
|
|
61
|
+
# systems:
|
|
62
|
+
# - name: a system
|
|
63
|
+
# backend: local
|
|
64
|
+
#
|
|
65
|
+
# ====== backend
|
|
66
|
+
#
|
|
67
|
+
# The value of the +backend+ key is a scalar which is used to select the
|
|
68
|
+
# {https://www.inspec.io/docs/reference/cli/#exec InSpec backend} for connections to the system.
|
|
69
|
+
#
|
|
70
|
+
# The scalar must match the name of one the available backends.
|
|
71
|
+
#
|
|
72
|
+
# <em>Example kitchen.yml</em>
|
|
73
|
+
# verifier:
|
|
74
|
+
# name: terraform
|
|
75
|
+
# systems:
|
|
76
|
+
# - name: a system
|
|
77
|
+
# backend: docker
|
|
78
|
+
#
|
|
79
|
+
# ===== Optional Keys
|
|
80
|
+
#
|
|
81
|
+
# The following keys may be included by any system to alter the behaviour of InSpec. Any key which is omitted
|
|
82
|
+
# will be associated with a default value as defined by InSpec except where otherwise noted.
|
|
83
|
+
#
|
|
84
|
+
# ====== attrs
|
|
85
|
+
#
|
|
86
|
+
# The value of the +attrs+ key is a sequence of scalars which is used to locate any
|
|
87
|
+
# {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes} files.
|
|
88
|
+
#
|
|
89
|
+
# <em>Example kitchen.yml</em>
|
|
90
|
+
# verifier:
|
|
91
|
+
# name: terraform
|
|
92
|
+
# systems:
|
|
93
|
+
# - name: a system
|
|
94
|
+
# backend: local
|
|
95
|
+
# attrs:
|
|
96
|
+
# - /path/to/first_attributes.yml
|
|
97
|
+
# - /path/to/second_attributes.yml
|
|
98
|
+
#
|
|
99
|
+
# ====== attrs_outputs
|
|
100
|
+
#
|
|
101
|
+
# The value of the +attrs_outputs+ key is a mapping of scalars to scalars which is used to define
|
|
102
|
+
# {https://www.inspec.io/docs/reference/profiles/#profile-attributes InSpec profile attributes} with the values
|
|
103
|
+
# of Terraform outputs.
|
|
104
|
+
#
|
|
105
|
+
# The use of the +attrs_outputs+ key is only necessary to override the default definitions of profile attributes
|
|
106
|
+
# with names and values equivalent to the outputs.
|
|
107
|
+
#
|
|
108
|
+
# <em>Example kitchen.yml</em>
|
|
109
|
+
# verifier:
|
|
110
|
+
# name: terraform
|
|
111
|
+
# systems:
|
|
112
|
+
# - name: a system
|
|
113
|
+
# backend: local
|
|
114
|
+
# attrs_outputs:
|
|
115
|
+
# an_attribute_name: an_output_name
|
|
116
|
+
#
|
|
117
|
+
# ====== backend_cache
|
|
118
|
+
#
|
|
119
|
+
# The value of the +backend_cache+ key is a boolean which is used to toggle the caching of InSpec backend command
|
|
120
|
+
# output.
|
|
121
|
+
#
|
|
122
|
+
# <em>Example kitchen.yml</em>
|
|
123
|
+
# verifier:
|
|
124
|
+
# name: terraform
|
|
125
|
+
# systems:
|
|
126
|
+
# - name: a system
|
|
127
|
+
# backend: local
|
|
128
|
+
# backend_cache: false
|
|
129
|
+
#
|
|
130
|
+
# ====== bastion_host
|
|
131
|
+
#
|
|
132
|
+
# The value of the +bastion_host+ key is a scalar which is used as the hostname of a
|
|
133
|
+
# {https://en.wikipedia.org/wiki/Bastion_host bastion host} to connect to before connecting to hosts in the
|
|
134
|
+
# system.
|
|
135
|
+
#
|
|
136
|
+
# The +bastion_host+ key must be used in combination with a backend which supports remote connections.
|
|
137
|
+
#
|
|
138
|
+
# The +bastion_host_output+ key will take priority over 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
|
+
#
|
|
148
|
+
# ====== bastion_host_output
|
|
149
|
+
#
|
|
150
|
+
# The value of the +bastion_host_output+ key is a scalar which is used to obtain the address of a bastion host in
|
|
151
|
+
# the system from a Terraform output.
|
|
152
|
+
#
|
|
153
|
+
# The scalar must match the name of an output with a value which is a string.
|
|
154
|
+
#
|
|
155
|
+
# The +bastion_host_output+ key must be used in combination with a backend which enables remote connections.
|
|
156
|
+
#
|
|
157
|
+
# <em>Example kitchen.yml</em>
|
|
158
|
+
# verifier:
|
|
159
|
+
# name: terraform
|
|
160
|
+
# systems:
|
|
161
|
+
# - name: a system
|
|
162
|
+
# backend: ssh
|
|
163
|
+
# bastion_host_output: an_output
|
|
164
|
+
#
|
|
165
|
+
# ====== bastion_port
|
|
166
|
+
#
|
|
167
|
+
# The value of the +bastion_port+ key is an integer which is used as the port number to connect to on the bastion
|
|
168
|
+
# host.
|
|
169
|
+
#
|
|
170
|
+
# The +bastion_port+ key must be used in combination with the +bastion_host_output+ key or the +bastion_host+ key.
|
|
171
|
+
#
|
|
172
|
+
# <em>Example kitchen.yml</em>
|
|
173
|
+
# verifier:
|
|
174
|
+
# name: terraform
|
|
175
|
+
# systems:
|
|
176
|
+
# - name: a system
|
|
177
|
+
# backend: ssh
|
|
178
|
+
# bastion_host_output: an_output
|
|
179
|
+
# bastion_port: 1234
|
|
180
|
+
#
|
|
181
|
+
# ====== bastion_user
|
|
182
|
+
#
|
|
183
|
+
# The value of the +bastion_user+ key is a scalar which is used as the username for authentication with the
|
|
184
|
+
# bastion host.
|
|
185
|
+
#
|
|
186
|
+
# The +bastion_user+ key must be used in combination with the +bastion_host_output+ key or the +bastion_host+ key.
|
|
187
|
+
#
|
|
188
|
+
# <em>Example kitchen.yml</em>
|
|
189
|
+
# verifier:
|
|
190
|
+
# name: terraform
|
|
191
|
+
# systems:
|
|
192
|
+
# - name: a system
|
|
193
|
+
# backend: ssh
|
|
194
|
+
# bastion_host_output: an_output
|
|
195
|
+
# bastion_user: bastion-user
|
|
196
|
+
#
|
|
197
|
+
# ====== controls
|
|
198
|
+
#
|
|
199
|
+
# The value of the +controls+ key is a sequence of scalars which is used to select for execution against the
|
|
200
|
+
# system a subset of the {https://www.inspec.io/docs/reference/dsl_inspec/ InSpec controls} of the profile.
|
|
201
|
+
#
|
|
202
|
+
# The use of the +controls+ key is only necessary if the system should not be tested with all of the controls of # the profile.
|
|
203
|
+
#
|
|
204
|
+
# The scalars must match the names of the controls, not the names of the control files.
|
|
205
|
+
#
|
|
206
|
+
# <em>Example kitchen.yml</em>
|
|
207
|
+
# verifier:
|
|
208
|
+
# name: terraform
|
|
209
|
+
# systems:
|
|
210
|
+
# - name: first system
|
|
211
|
+
# backend: local
|
|
212
|
+
# controls:
|
|
213
|
+
# - first control
|
|
214
|
+
# - third control
|
|
215
|
+
# - name: second system
|
|
216
|
+
# backend: local
|
|
217
|
+
# controls:
|
|
218
|
+
# - second control
|
|
219
|
+
# - fourth control
|
|
220
|
+
#
|
|
221
|
+
# ====== enable_password
|
|
222
|
+
#
|
|
223
|
+
# The value of the +enable_password+ key is a scalar which is used as the password for authentication with a
|
|
224
|
+
# Cisco IOS device in enable mode.
|
|
225
|
+
#
|
|
226
|
+
# The +enable_password+ key must be used in combination with <tt>backend: ssh</tt>.
|
|
227
|
+
#
|
|
228
|
+
# <em>Example kitchen.yml</em>
|
|
229
|
+
# verifier:
|
|
230
|
+
# name: terraform
|
|
231
|
+
# systems:
|
|
232
|
+
# - name: a system
|
|
233
|
+
# backend: ssh
|
|
234
|
+
# enable_password: Cisc0!
|
|
235
|
+
#
|
|
236
|
+
# ====== hosts
|
|
237
|
+
#
|
|
238
|
+
# The value of the +hosts+ key is a sequence of scalars which is used as addresses of hosts in the system.
|
|
239
|
+
#
|
|
240
|
+
# The +hosts+ key must be used in combination with a backend which enables remote connections.
|
|
241
|
+
#
|
|
242
|
+
# <em>Example kitchen.yml</em>
|
|
243
|
+
# verifier:
|
|
244
|
+
# name: terraform
|
|
245
|
+
# systems:
|
|
246
|
+
# - name: a system
|
|
247
|
+
# backend: ssh
|
|
248
|
+
# hosts:
|
|
249
|
+
# - hostname.domainname
|
|
250
|
+
#
|
|
251
|
+
# ====== hosts_output
|
|
252
|
+
#
|
|
253
|
+
# The value of the +hosts_output+ key is a scalar which is used to obtain the addresses of hosts in the system
|
|
254
|
+
# from a Terraform output.
|
|
255
|
+
#
|
|
256
|
+
# The scalar must match the name of an output with a value which is a string or an array of strings.
|
|
257
|
+
#
|
|
258
|
+
# The +hosts_output+ key must be used in combination with a backend which enables remote connections.
|
|
259
|
+
#
|
|
260
|
+
# <em>Example kitchen.yml</em>
|
|
261
|
+
# verifier:
|
|
262
|
+
# name: terraform
|
|
263
|
+
# systems:
|
|
264
|
+
# - name: a system
|
|
265
|
+
# backend: ssh
|
|
266
|
+
# hosts_output: an_output
|
|
267
|
+
#
|
|
268
|
+
# ====== key_files
|
|
269
|
+
#
|
|
270
|
+
# The value of the +key_files+ key is a sequence of scalars which is used to locate key files (also known as
|
|
271
|
+
# identity files) for {https://linux.die.net/man/1/ssh Secure Shell (SSH) authentication} with hosts in the
|
|
272
|
+
# Terraform state.
|
|
273
|
+
#
|
|
274
|
+
# The +key_files+ key must be used in combination with <tt>backend: ssh</tt>.
|
|
275
|
+
#
|
|
276
|
+
# <em>Example kitchen.yml</em>
|
|
277
|
+
# verifier:
|
|
278
|
+
# name: terraform
|
|
279
|
+
# systems:
|
|
280
|
+
# - name: a system
|
|
281
|
+
# backend: ssh
|
|
282
|
+
# key_files:
|
|
283
|
+
# - /path/to/first/key/file
|
|
284
|
+
# - /path/to/second/key/file
|
|
285
|
+
#
|
|
286
|
+
# ====== password
|
|
287
|
+
#
|
|
288
|
+
# The value of the +password+ key is a scalar which is used as the password for authentication with hosts in the
|
|
289
|
+
# system.
|
|
290
|
+
#
|
|
291
|
+
# The +password+ key must be used in combination with a backend which supports password authentication.
|
|
292
|
+
#
|
|
293
|
+
# <em>Example kitchen.yml</em>
|
|
294
|
+
# verifier:
|
|
295
|
+
# name: terraform
|
|
296
|
+
# systems:
|
|
297
|
+
# - name: a system
|
|
298
|
+
# backend: ssh
|
|
299
|
+
# password: Th3P455I5Th3W0rd
|
|
300
|
+
#
|
|
301
|
+
# ====== path
|
|
302
|
+
#
|
|
303
|
+
# The value of the +path+ key is a scalar which is used as the login path when connecting to a host in the system.
|
|
304
|
+
#
|
|
305
|
+
# The +path+ key must be used in combination with <tt>backend: winrm</tt>.
|
|
306
|
+
#
|
|
307
|
+
# <em>Example kitchen.yml</em>
|
|
308
|
+
# verifier:
|
|
309
|
+
# name: terraform
|
|
310
|
+
# systems:
|
|
311
|
+
# - name: a system
|
|
312
|
+
# backend: winrm
|
|
313
|
+
# path: /login
|
|
314
|
+
#
|
|
315
|
+
# ====== port
|
|
316
|
+
#
|
|
317
|
+
# The value of the +port+ key is an integer which is used as the port number when connecting via SSH to the hosts
|
|
318
|
+
# of the system.
|
|
319
|
+
#
|
|
320
|
+
# The +port+ key must be used in combination with <tt>backend: ssh</tt>.
|
|
321
|
+
#
|
|
322
|
+
# If the +port+ key is omitted then the value of the +port+ key of the Test Kitchen transport will be used.
|
|
323
|
+
#
|
|
324
|
+
# <em>Example kitchen.yml</em>
|
|
325
|
+
# verifier:
|
|
326
|
+
# name: terraform
|
|
327
|
+
# systems:
|
|
328
|
+
# - name: a system
|
|
329
|
+
# backend: ssh
|
|
330
|
+
# port: 1234
|
|
331
|
+
#
|
|
332
|
+
# ====== profile_locations
|
|
333
|
+
#
|
|
334
|
+
# The value of the <code>profile_locations</code> key is a sequence of scalars which is used to locate
|
|
335
|
+
# {https://www.inspec.io/docs/reference/profiles/ InSpec profiles} containing the controls to be executed against
|
|
336
|
+
# the system. This key corresponds to the LOCATIONS argument of <code>inspec exec</code>.
|
|
337
|
+
#
|
|
338
|
+
# The default value contains a single scalar which assumes that a profile exists locally for the associated
|
|
339
|
+
# {https://kitchen.ci/docs/getting-started/adding-suite Kitchen suite} at
|
|
340
|
+
# <code><KITCHEN ROOT>/test/integration/<KITCHEN SUITE NAME></code>.
|
|
341
|
+
#
|
|
342
|
+
# <em>Example kitchen.yml</em>
|
|
343
|
+
# verifier:
|
|
344
|
+
# name: terraform
|
|
345
|
+
# systems:
|
|
346
|
+
# - name: a system
|
|
347
|
+
# backend: local
|
|
348
|
+
# profile_locations:
|
|
349
|
+
# - supermarket://username/linux-baseline
|
|
350
|
+
# - /path/to/profile
|
|
351
|
+
# - /path/to/a_test.rb
|
|
352
|
+
#
|
|
353
|
+
# ====== proxy_command
|
|
354
|
+
#
|
|
355
|
+
# The value of the +proxy_command+ key is a scalar which is used as a proxy command when connecting to a host via
|
|
356
|
+
# SSH.
|
|
357
|
+
#
|
|
358
|
+
# The +proxy_command+ key must be used in combination with <tt>backend: ssh</tt>.
|
|
359
|
+
#
|
|
360
|
+
# <em>Example kitchen.yml</em>
|
|
361
|
+
# verifier:
|
|
362
|
+
# name: terraform
|
|
363
|
+
# systems:
|
|
364
|
+
# - name: a system
|
|
365
|
+
# backend: ssh
|
|
366
|
+
# proxy_command: ssh root@127.0.0.1 -W %h:%p
|
|
367
|
+
#
|
|
368
|
+
# ====== reporter
|
|
369
|
+
#
|
|
370
|
+
# The value of the +reporter+ key is a sequence of scalars which is used to select the
|
|
371
|
+
# {https://www.inspec.io/docs/reference/reporters/#supported-reporters InSpec reporters}
|
|
372
|
+
# for reporting test output.
|
|
373
|
+
#
|
|
374
|
+
# The scalars must match the names of the available reporters.
|
|
375
|
+
#
|
|
376
|
+
# <em>Example kitchen.yml</em>
|
|
377
|
+
# verifier:
|
|
378
|
+
# name: terraform
|
|
379
|
+
# systems:
|
|
380
|
+
# - name: a system
|
|
381
|
+
# backend: local
|
|
382
|
+
# reporter:
|
|
383
|
+
# - cli
|
|
384
|
+
# - documentation
|
|
385
|
+
#
|
|
386
|
+
# ====== self_signed
|
|
387
|
+
#
|
|
388
|
+
# The value of the +self_signed+ key is a boolean which is used to toggle permission for self-signed certificates
|
|
389
|
+
# during testing of Windows hosts.
|
|
390
|
+
#
|
|
391
|
+
# The +self_signed+ key must be used in combination with <tt>backend: winrm</tt>.
|
|
392
|
+
#
|
|
393
|
+
# <em>Example kitchen.yml</em>
|
|
394
|
+
# verifier:
|
|
395
|
+
# name: terraform
|
|
396
|
+
# systems:
|
|
397
|
+
# - name: a system
|
|
398
|
+
# backend: winrm
|
|
399
|
+
# self_signed: true
|
|
400
|
+
#
|
|
401
|
+
# ====== shell
|
|
402
|
+
#
|
|
403
|
+
# The value of the +shell+ key is a boolean which is used to toggle the use of a subshell when executing tests on
|
|
404
|
+
# hosts in the system.
|
|
405
|
+
#
|
|
406
|
+
# The +shell+ key is only effective for a system which has Unix-like hosts.
|
|
407
|
+
#
|
|
408
|
+
# <em>Example kitchen.yml</em>
|
|
409
|
+
# verifier:
|
|
410
|
+
# name: terraform
|
|
411
|
+
# systems:
|
|
412
|
+
# - name: a system
|
|
413
|
+
# backend: ssh
|
|
414
|
+
# hosts_output: an_output
|
|
415
|
+
# shell: true
|
|
416
|
+
#
|
|
417
|
+
# ====== shell_command
|
|
418
|
+
#
|
|
419
|
+
# The value of the +shell_command+ key is a scalar which is used to override the default shell command used to
|
|
420
|
+
# instantiate a subshell.
|
|
421
|
+
#
|
|
422
|
+
# The +shell_command+ key must be used in combination with <tt>shell: true</tt>.
|
|
423
|
+
#
|
|
424
|
+
# <em>Example kitchen.yml</em>
|
|
425
|
+
# verifier:
|
|
426
|
+
# name: terraform
|
|
427
|
+
# systems:
|
|
428
|
+
# - name: a system
|
|
429
|
+
# backend: ssh
|
|
430
|
+
# hosts_output: an_output
|
|
431
|
+
# shell: true
|
|
432
|
+
# shell_command: /bin/ksh
|
|
433
|
+
#
|
|
434
|
+
# ====== shell_options
|
|
435
|
+
#
|
|
436
|
+
# The value of the +shell_options+ key is a scalar which is used to provide options to the subshell.
|
|
437
|
+
#
|
|
438
|
+
# The +shell_options+ key must be used in combination with <tt>shell: true</tt>.
|
|
439
|
+
#
|
|
440
|
+
# <em>Example kitchen.yml</em>
|
|
441
|
+
# verifier:
|
|
442
|
+
# name: terraform
|
|
443
|
+
# systems:
|
|
444
|
+
# - name: a system
|
|
445
|
+
# backend: ssh
|
|
446
|
+
# hosts_output: an_output
|
|
447
|
+
# shell: true
|
|
448
|
+
# shell_options: -v
|
|
449
|
+
#
|
|
450
|
+
# ====== show_progress
|
|
451
|
+
#
|
|
452
|
+
# The value of the +show_progress+ key is a boolean which is used to toggle the display of progress while tests
|
|
453
|
+
# are executing.
|
|
454
|
+
#
|
|
455
|
+
# <em>Example kitchen.yml</em>
|
|
456
|
+
# verifier:
|
|
457
|
+
# name: terraform
|
|
458
|
+
# systems:
|
|
459
|
+
# - name: a system
|
|
460
|
+
# backend: local
|
|
461
|
+
# show_progress: false
|
|
462
|
+
#
|
|
463
|
+
# ====== ssl
|
|
464
|
+
#
|
|
465
|
+
# The value of the +ssl+ key is a boolean which is used to toggle the use of
|
|
466
|
+
# {https://en.wikipedia.org/wiki/Transport_Layer_Security Transport Layer Security (TLS)} when connecting to
|
|
467
|
+
# hosts in the system. InSpec's reference to Secure Socket Layer (SSL) is a misnomer as that protocol has been
|
|
468
|
+
# deprecated in favour of TLS.
|
|
469
|
+
#
|
|
470
|
+
# The +ssl+ key must be used in combination with <tt>backend: winrm</tt>.
|
|
471
|
+
#
|
|
472
|
+
# <em>Example kitchen.yml</em>
|
|
473
|
+
# verifier:
|
|
474
|
+
# name: terraform
|
|
475
|
+
# systems:
|
|
476
|
+
# - name: a system
|
|
477
|
+
# backend: winrm
|
|
478
|
+
# ssl: true
|
|
479
|
+
#
|
|
480
|
+
# ====== sudo
|
|
481
|
+
#
|
|
482
|
+
# The value of the +sudo+ key is a boolean which is used to toggle the use of
|
|
483
|
+
# {https://en.wikipedia.org/wiki/Sudo sudo} for obtaining superuser permissions when executing tests on hosts in
|
|
484
|
+
# the system.
|
|
485
|
+
#
|
|
486
|
+
# The +sudo+ key is only effective for a system which has Unix-like hosts.
|
|
487
|
+
#
|
|
488
|
+
# <em>Example kitchen.yml</em>
|
|
489
|
+
# verifier:
|
|
490
|
+
# name: terraform
|
|
491
|
+
# systems:
|
|
492
|
+
# - name: a system
|
|
493
|
+
# backend: ssh
|
|
494
|
+
# hosts_output: an_output
|
|
495
|
+
# sudo: true
|
|
496
|
+
#
|
|
497
|
+
# ====== sudo_command
|
|
498
|
+
#
|
|
499
|
+
# The value of the +sudo_command+ key is a scalar which is used to override the default command used to
|
|
500
|
+
# invoke sudo.
|
|
501
|
+
#
|
|
502
|
+
# The +sudo_command+ key must be used in combination with <tt>sudo: true</tt>.
|
|
503
|
+
#
|
|
504
|
+
# <em>Example kitchen.yml</em>
|
|
505
|
+
# verifier:
|
|
506
|
+
# name: terraform
|
|
507
|
+
# systems:
|
|
508
|
+
# - name: a system
|
|
509
|
+
# backend: ssh
|
|
510
|
+
# hosts_output: an_output
|
|
511
|
+
# sudo: true
|
|
512
|
+
# sudo_command: /bin/sudo
|
|
513
|
+
#
|
|
514
|
+
# ====== sudo_options
|
|
515
|
+
#
|
|
516
|
+
# The value of the +sudo_options+ key is a scalar which is used to provide options to the sudo command.
|
|
517
|
+
#
|
|
518
|
+
# The +sudo_options+ key must be used in combination with <tt>sudo: true</tt>.
|
|
519
|
+
#
|
|
520
|
+
# <em>Example kitchen.yml</em>
|
|
521
|
+
# verifier:
|
|
522
|
+
# name: terraform
|
|
523
|
+
# systems:
|
|
524
|
+
# - name: a system
|
|
525
|
+
# backend: ssh
|
|
526
|
+
# hosts_output: an_output
|
|
527
|
+
# sudo: true
|
|
528
|
+
# sudo_options: -u admin
|
|
529
|
+
#
|
|
530
|
+
# ====== sudo_password
|
|
531
|
+
#
|
|
532
|
+
# The value of the +sudo_password+ key is a scalar which is used as the password for authentication with the sudo
|
|
533
|
+
# command.
|
|
534
|
+
#
|
|
535
|
+
# The +sudo_password+ key must be used in combination with <tt>sudo: true</tt>.
|
|
536
|
+
#
|
|
537
|
+
# <em>Example kitchen.yml</em>
|
|
538
|
+
# verifier:
|
|
539
|
+
# name: terraform
|
|
540
|
+
# systems:
|
|
541
|
+
# - name: a system
|
|
542
|
+
# backend: ssh
|
|
543
|
+
# hosts_output: an_output
|
|
544
|
+
# sudo: true
|
|
545
|
+
# sudo_password: Th3P455I5Th3W0rd
|
|
546
|
+
#
|
|
547
|
+
# ====== user
|
|
548
|
+
#
|
|
549
|
+
# The value of the +user+ key is a scalar which is used as the username for authentication with hosts in the
|
|
550
|
+
# system.
|
|
551
|
+
#
|
|
552
|
+
# The +user+ key must be used in combination with a backend which supports user authentication.
|
|
553
|
+
#
|
|
554
|
+
# <em>Example kitchen.yml</em>
|
|
555
|
+
# verifier:
|
|
556
|
+
# name: terraform
|
|
557
|
+
# systems:
|
|
558
|
+
# - name: a system
|
|
559
|
+
# backend: ssh
|
|
560
|
+
# user: tester
|
|
561
|
+
#
|
|
562
|
+
# ====== vendor_cache
|
|
563
|
+
#
|
|
564
|
+
# The value of the +vendor_cache+ key is a scalar which is used as the pathname of the directory in which InSpec
|
|
565
|
+
# will cache dependencies of the profile.
|
|
566
|
+
#
|
|
567
|
+
# <em>Example kitchen.yml</em>
|
|
568
|
+
# verifier:
|
|
569
|
+
# name: terraform
|
|
570
|
+
# systems:
|
|
571
|
+
# - name: a system
|
|
572
|
+
# backend: local
|
|
573
|
+
# vendor_cache: /opt/inspec-cache
|
|
26
574
|
module Systems
|
|
27
575
|
::Kitchen::Terraform::ConfigAttribute.new(
|
|
28
576
|
attribute: :systems,
|
|
29
577
|
default_value: lambda do
|
|
30
578
|
[]
|
|
31
579
|
end,
|
|
32
|
-
schema: ::Kitchen::Terraform::
|
|
580
|
+
schema: ::Kitchen::Terraform::ConfigAttributeContract::Systems.new,
|
|
33
581
|
).apply config_attribute: self
|
|
34
582
|
end
|
|
35
583
|
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,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
|
|
@@ -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
|