kitchen-terraform 5.5.0 → 5.8.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 -4
- data/lib/kitchen/terraform/command/init.rb +2 -79
- 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_factory.rb +52 -0
- data/lib/kitchen/terraform/command/validate.rb +2 -40
- 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_factory.rb +54 -0
- data/lib/kitchen/terraform/command_flag/upgrade.rb +1 -1
- data/lib/kitchen/terraform/configurable.rb +1 -1
- data/lib/kitchen/terraform/driver/create.rb +36 -13
- data/lib/kitchen/terraform/driver/destroy.rb +48 -16
- data/lib/kitchen/terraform/inspec_runner.rb +7 -0
- data/lib/kitchen/terraform/provisioner/converge.rb +49 -22
- data/lib/kitchen/terraform/shell_out.rb +4 -3
- data/lib/kitchen/terraform/verify_version.rb +4 -16
- data/lib/kitchen/terraform/version.rb +1 -1
- data/lib/kitchen/verifier/terraform.rb +1 -1
- metadata +59 -63
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 449214862b898292af37271daa4aa2926650f252544bd1d72b778f5402631653
|
|
4
|
+
data.tar.gz: c7ea868e644097ff0302c12264a98d205da4368d30f926d860779fb5cf88bb98
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98e59c3a77923430fbff7319968572174c54e52bcb987750e92a70e4dc35a74c8c590422d5467048fbda7480e2bb2d95710cbe6e5b3f576bd071038ba2e135ce
|
|
7
|
+
data.tar.gz: 6279a30cecd3b277bcac512c6da9c80b91f8fd7e6aa307876206161171e773291c94fe406b8ef88b00cd35a3b0745008b3b3a1324cd4a5e78844801b96ac7378
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data.tar.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Installation instructions can be found in the
|
|
|
36
36
|
[Terraform: Install Terraform][terraform-install] article.
|
|
37
37
|
|
|
38
38
|
Kitchen-Terraform supports versions of Terraform in the interval of
|
|
39
|
-
`>= 0.11.4, <
|
|
39
|
+
`>= 0.11.4, < 1.1.0`.
|
|
40
40
|
|
|
41
41
|
[tfenv] can be used to manage versions of Terraform on the system.
|
|
42
42
|
|
|
@@ -75,7 +75,7 @@ the semantic versioning of the Ruby gem.
|
|
|
75
75
|
|
|
76
76
|
```ruby
|
|
77
77
|
source "https://rubygems.org/" do
|
|
78
|
-
gem "kitchen-terraform", "~> 5.
|
|
78
|
+
gem "kitchen-terraform", "~> 5.7"
|
|
79
79
|
end
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -102,7 +102,7 @@ example.
|
|
|
102
102
|
> Installing Kitchen-Terraform with RubyGems
|
|
103
103
|
|
|
104
104
|
```sh
|
|
105
|
-
gem install kitchen-terraform --version 5.
|
|
105
|
+
gem install kitchen-terraform --version 5.8.0
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
This approach is not recommended as it requires more effort to install
|
|
@@ -281,4 +281,3 @@ Kitchen-Terraform is distributed under the [Apache License][license].
|
|
|
281
281
|
[tfenv]: https://github.com/kamatama41/tfenv
|
|
282
282
|
[travis-build-status-shield]: https://img.shields.io/travis/com/newcontext-oss/kitchen-terraform.svg
|
|
283
283
|
[travis-build-status]: https://travis-ci.com/newcontext-oss/kitchen-terraform
|
|
284
|
-
|
|
@@ -14,88 +14,11 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
|
-
require "kitchen/terraform/command_flag/backend_config"
|
|
18
|
-
require "kitchen/terraform/command_flag/color"
|
|
19
|
-
require "kitchen/terraform/command_flag/lock_timeout"
|
|
20
|
-
require "kitchen/terraform/command_flag/plugin_dir"
|
|
21
|
-
require "kitchen/terraform/command_flag/upgrade"
|
|
22
|
-
|
|
23
17
|
module Kitchen
|
|
24
18
|
module Terraform
|
|
25
19
|
module Command
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
# -input=false \
|
|
29
|
-
# -lock=<lock> \
|
|
30
|
-
# -lock-timeout=<lock_timeout>s \
|
|
31
|
-
# [-no-color] \
|
|
32
|
-
# [-upgrade] \
|
|
33
|
-
# -force-copy \
|
|
34
|
-
# -backend=true \
|
|
35
|
-
# [-backend-config=<backend_configurations[0]> ...] \
|
|
36
|
-
# -get=true \
|
|
37
|
-
# -get-plugins=true \
|
|
38
|
-
# [-plugin-dir=<plugin_directory>] \
|
|
39
|
-
# -verify-plugins=true \
|
|
40
|
-
# <root_module_directory>
|
|
41
|
-
class Init
|
|
42
|
-
# #initialize prepares a new instance of the class.
|
|
43
|
-
#
|
|
44
|
-
# @param config [Hash] the configuration of the driver.
|
|
45
|
-
# @option config [Hash{String=>String}] :backend_configurations Terraform backend configuration arguments to
|
|
46
|
-
# complete a partial backend configuration.
|
|
47
|
-
# @option config [Boolean] :color a toggle of colored output from the Terraform client.
|
|
48
|
-
# @option config [Integer] :command_timeout the the number of seconds to wait for the command to finish running.
|
|
49
|
-
# @option config [Boolean] :lock a toggle of locking for the Terraform state file.
|
|
50
|
-
# @option config [Integer] :lock_timeout the number of seconds that the Terraform client will wait for a lock
|
|
51
|
-
# on the state to be obtained during operations.
|
|
52
|
-
# @option config [String] :plugin_directory the pathname of the directory which contains
|
|
53
|
-
# customized Terraform provider plugins to install in place of the official Terraform provider plugins.
|
|
54
|
-
# @option config [String] :root_module_directory the pathname of the directory which contains the root
|
|
55
|
-
# Terraform module.
|
|
56
|
-
# @option config [Boolean] :upgrade_during_init a toggle for upgrading modules and plugins.
|
|
57
|
-
# @return [Kitchen::Terraform::Command::Init]
|
|
58
|
-
def initialize(config:)
|
|
59
|
-
self.backend_config = ::Kitchen::Terraform::CommandFlag::BackendConfig.new arguments: config.fetch(
|
|
60
|
-
:backend_configurations
|
|
61
|
-
)
|
|
62
|
-
self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
|
|
63
|
-
self.lock = config.fetch :lock
|
|
64
|
-
self.lock_timeout = ::Kitchen::Terraform::CommandFlag::LockTimeout.new duration: config.fetch(:lock_timeout)
|
|
65
|
-
self.plugin_dir = ::Kitchen::Terraform::CommandFlag::PluginDir.new pathname: config.fetch(
|
|
66
|
-
:plugin_directory
|
|
67
|
-
)
|
|
68
|
-
self.upgrade = ::Kitchen::Terraform::CommandFlag::Upgrade.new enabled: config.fetch(:upgrade_during_init)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# @return [String] the command with flags.
|
|
72
|
-
def to_s
|
|
73
|
-
"init " \
|
|
74
|
-
"-input=false " \
|
|
75
|
-
"-lock=#{lock} " \
|
|
76
|
-
"#{lock_timeout} " \
|
|
77
|
-
"#{color} " \
|
|
78
|
-
"#{upgrade} " \
|
|
79
|
-
"-force-copy " \
|
|
80
|
-
"-backend=true " \
|
|
81
|
-
"#{backend_config} " \
|
|
82
|
-
"-get=true " \
|
|
83
|
-
"-get-plugins=true " \
|
|
84
|
-
"#{plugin_dir} " \
|
|
85
|
-
"-verify-plugins=true"
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
private
|
|
89
|
-
|
|
90
|
-
attr_accessor(
|
|
91
|
-
:backend_config,
|
|
92
|
-
:color,
|
|
93
|
-
:lock,
|
|
94
|
-
:lock_timeout,
|
|
95
|
-
:options,
|
|
96
|
-
:plugin_dir,
|
|
97
|
-
:upgrade,
|
|
98
|
-
)
|
|
20
|
+
# Init is the namespace for Terraform Init commands.
|
|
21
|
+
module Init
|
|
99
22
|
end
|
|
100
23
|
end
|
|
101
24
|
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016-2019 New Context, 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/command_flag/backend_config"
|
|
18
|
+
require "kitchen/terraform/command_flag/color"
|
|
19
|
+
require "kitchen/terraform/command_flag/lock_timeout"
|
|
20
|
+
require "kitchen/terraform/command_flag/plugin_dir"
|
|
21
|
+
require "kitchen/terraform/command_flag/upgrade"
|
|
22
|
+
|
|
23
|
+
module Kitchen
|
|
24
|
+
module Terraform
|
|
25
|
+
module Command
|
|
26
|
+
module Init
|
|
27
|
+
# The working directory is initialized by running a command like the following example:
|
|
28
|
+
# terraform init \
|
|
29
|
+
# -backend=true \
|
|
30
|
+
# [-backend-config=<backend_configurations[0]> ...] \
|
|
31
|
+
# -force-copy \
|
|
32
|
+
# -get=true \
|
|
33
|
+
# -input=false \
|
|
34
|
+
# [-no-color] \
|
|
35
|
+
# [-plugin-dir=<plugin_directory>] \
|
|
36
|
+
# [-upgrade=true] \
|
|
37
|
+
# <root_module_directory>
|
|
38
|
+
class PostZeroFifteenZero
|
|
39
|
+
# #initialize prepares a new instance of the class.
|
|
40
|
+
#
|
|
41
|
+
# @param config [Hash] the configuration of the driver.
|
|
42
|
+
# @option config [Hash{String=>String}] :backend_configurations Terraform backend configuration arguments to
|
|
43
|
+
# complete a partial backend configuration.
|
|
44
|
+
# @option config [Boolean] :color a toggle of colored output from the Terraform client.
|
|
45
|
+
# on the state to be obtained during operations.
|
|
46
|
+
# @option config [String] :plugin_directory the pathname of the directory which contains
|
|
47
|
+
# customized Terraform provider plugins to install in place of the official Terraform provider plugins.
|
|
48
|
+
# @option config [Boolean] :upgrade_during_init a toggle for upgrading modules and plugins.
|
|
49
|
+
# @return [Kitchen::Terraform::Command::Init::PostZeroFifteenZero]
|
|
50
|
+
def initialize(config:)
|
|
51
|
+
self.backend_config = ::Kitchen::Terraform::CommandFlag::BackendConfig.new arguments: config.fetch(
|
|
52
|
+
:backend_configurations
|
|
53
|
+
)
|
|
54
|
+
self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
|
|
55
|
+
self.plugin_dir = ::Kitchen::Terraform::CommandFlag::PluginDir.new pathname: config.fetch(
|
|
56
|
+
:plugin_directory
|
|
57
|
+
)
|
|
58
|
+
self.upgrade = ::Kitchen::Terraform::CommandFlag::Upgrade.new enabled: config.fetch(:upgrade_during_init)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# @return [String] the command with flags.
|
|
62
|
+
def to_s
|
|
63
|
+
"init " \
|
|
64
|
+
"-backend=true " \
|
|
65
|
+
"#{backend_config} " \
|
|
66
|
+
"-force-copy=true " \
|
|
67
|
+
"-get=true " \
|
|
68
|
+
"-input=false " \
|
|
69
|
+
"#{color} " \
|
|
70
|
+
"#{plugin_dir} " \
|
|
71
|
+
"#{upgrade}"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
attr_accessor(
|
|
77
|
+
:backend_config,
|
|
78
|
+
:color,
|
|
79
|
+
:lock,
|
|
80
|
+
:lock_timeout,
|
|
81
|
+
:options,
|
|
82
|
+
:plugin_dir,
|
|
83
|
+
:upgrade,
|
|
84
|
+
)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016-2019 New Context, 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/command_flag/backend_config"
|
|
18
|
+
require "kitchen/terraform/command_flag/color"
|
|
19
|
+
require "kitchen/terraform/command_flag/lock_timeout"
|
|
20
|
+
require "kitchen/terraform/command_flag/plugin_dir"
|
|
21
|
+
require "kitchen/terraform/command_flag/upgrade"
|
|
22
|
+
|
|
23
|
+
module Kitchen
|
|
24
|
+
module Terraform
|
|
25
|
+
module Command
|
|
26
|
+
module Init
|
|
27
|
+
# The working directory is initialized by running a command like the following example:
|
|
28
|
+
# terraform init \
|
|
29
|
+
# -backend=true \
|
|
30
|
+
# [-backend-config=<backend_configurations[0]> ...] \
|
|
31
|
+
# -force-copy \
|
|
32
|
+
# -get=true \
|
|
33
|
+
# -get-plugins=true \
|
|
34
|
+
# -input=false \
|
|
35
|
+
# -lock=<lock> \
|
|
36
|
+
# -lock-timeout=<lock_timeout>s \
|
|
37
|
+
# [-no-color] \
|
|
38
|
+
# [-plugin-dir=<plugin_directory>] \
|
|
39
|
+
# [-upgrade=true] \
|
|
40
|
+
# -verify-plugins=true \
|
|
41
|
+
# <root_module_directory>
|
|
42
|
+
class PreZeroFifteenZero
|
|
43
|
+
# #initialize prepares a new instance of the class.
|
|
44
|
+
#
|
|
45
|
+
# @param config [Hash] the configuration of the driver.
|
|
46
|
+
# @option config [Hash{String=>String}] :backend_configurations Terraform backend configuration arguments to
|
|
47
|
+
# complete a partial backend configuration.
|
|
48
|
+
# @option config [Boolean] :color a toggle of colored output from the Terraform client.
|
|
49
|
+
# @option config [Boolean] :lock a toggle of locking for the Terraform state file.
|
|
50
|
+
# @option config [Integer] :lock_timeout the number of seconds that the Terraform client will wait for a lock
|
|
51
|
+
# on the state to be obtained during operations.
|
|
52
|
+
# @option config [String] :plugin_directory the pathname of the directory which contains
|
|
53
|
+
# customized Terraform provider plugins to install in place of the official Terraform provider plugins.
|
|
54
|
+
# @option config [Boolean] :upgrade_during_init a toggle for upgrading modules and plugins.
|
|
55
|
+
# @return [Kitchen::Terraform::Command::Init::PreZeroFifteenZero]
|
|
56
|
+
def initialize(config:)
|
|
57
|
+
self.backend_config = ::Kitchen::Terraform::CommandFlag::BackendConfig.new arguments: config.fetch(
|
|
58
|
+
:backend_configurations
|
|
59
|
+
)
|
|
60
|
+
self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
|
|
61
|
+
self.lock = config.fetch :lock
|
|
62
|
+
self.lock_timeout = ::Kitchen::Terraform::CommandFlag::LockTimeout.new duration: config.fetch(:lock_timeout)
|
|
63
|
+
self.plugin_dir = ::Kitchen::Terraform::CommandFlag::PluginDir.new pathname: config.fetch(
|
|
64
|
+
:plugin_directory
|
|
65
|
+
)
|
|
66
|
+
self.upgrade = ::Kitchen::Terraform::CommandFlag::Upgrade.new enabled: config.fetch(:upgrade_during_init)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @return [String] the command with flags.
|
|
70
|
+
def to_s
|
|
71
|
+
"init " \
|
|
72
|
+
"-backend=true " \
|
|
73
|
+
"#{backend_config} " \
|
|
74
|
+
"-force-copy=true " \
|
|
75
|
+
"-get=true " \
|
|
76
|
+
"-get-plugins=true " \
|
|
77
|
+
"-input=false " \
|
|
78
|
+
"-lock=#{lock} " \
|
|
79
|
+
"#{lock_timeout} " \
|
|
80
|
+
"#{color} " \
|
|
81
|
+
"#{plugin_dir} " \
|
|
82
|
+
"#{upgrade} " \
|
|
83
|
+
"-verify-plugins=true"
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
private
|
|
87
|
+
|
|
88
|
+
attr_accessor(
|
|
89
|
+
:backend_config,
|
|
90
|
+
:color,
|
|
91
|
+
:lock,
|
|
92
|
+
:lock_timeout,
|
|
93
|
+
:options,
|
|
94
|
+
:plugin_dir,
|
|
95
|
+
:upgrade,
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016-2019 New Context, 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/command/init/post_zero_fifteen_zero"
|
|
18
|
+
require "kitchen/terraform/command/init/pre_zero_fifteen_zero"
|
|
19
|
+
require "rubygems"
|
|
20
|
+
|
|
21
|
+
module Kitchen
|
|
22
|
+
module Terraform
|
|
23
|
+
module Command
|
|
24
|
+
# InitFactory is the class of objects which build Init objects.
|
|
25
|
+
class InitFactory
|
|
26
|
+
# #build creates a new instance of an Init object.
|
|
27
|
+
#
|
|
28
|
+
# @param config [Hash] the configuration of the driver.
|
|
29
|
+
# @return [Kitchen::Terraform::Command::Init::PreZeroFifteenZero,
|
|
30
|
+
# Kitchen::Terraform::Command::Init::PostZeroFifteenZero]
|
|
31
|
+
def build(config:)
|
|
32
|
+
return ::Kitchen::Terraform::Command::Init::PreZeroFifteenZero.new config: config if requirement.satisfied_by? version
|
|
33
|
+
|
|
34
|
+
::Kitchen::Terraform::Command::Init::PostZeroFifteenZero.new config: config
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# #initialize prepares a new instance of the class
|
|
38
|
+
#
|
|
39
|
+
# @param version [Gem::Version] a client version.
|
|
40
|
+
# @return [Kitchen::Terraform::Command::InitFactory]
|
|
41
|
+
def initialize(version:)
|
|
42
|
+
self.requirement = ::Gem::Requirement.new "< 0.15.0"
|
|
43
|
+
self.version = version
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
attr_accessor :requirement, :version
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -14,49 +14,11 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
|
-
require "kitchen/terraform/command_flag/color"
|
|
18
|
-
require "kitchen/terraform/command_flag/var_file"
|
|
19
|
-
require "kitchen/terraform/command_flag/var"
|
|
20
|
-
require "shellwords"
|
|
21
|
-
|
|
22
17
|
module Kitchen
|
|
23
18
|
module Terraform
|
|
24
19
|
module Command
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
# [-no-color] \
|
|
28
|
-
# [-var=<variables.first>...] \
|
|
29
|
-
# [-var-file=<variable_files.first>...] \
|
|
30
|
-
# <directory>
|
|
31
|
-
class Validate
|
|
32
|
-
# #initialize prepares a new instance of the class.
|
|
33
|
-
#
|
|
34
|
-
# @param config [Hash] the configuration of the driver.
|
|
35
|
-
# @option config [Boolean] :color a toggle of colored output from the Terraform client.
|
|
36
|
-
# @option config [Array<String>] :variable_files a list of pathnames of Terraform variable files to evaluate.
|
|
37
|
-
# @option config [Hash{String=>String}] :variables a mapping of Terraform variables to evaluate.
|
|
38
|
-
# @return [Kitchen::Terraform::Command::Validate]
|
|
39
|
-
def initialize(config:)
|
|
40
|
-
self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
|
|
41
|
-
self.var_file = ::Kitchen::Terraform::CommandFlag::VarFile.new pathnames: config.fetch(:variable_files)
|
|
42
|
-
self.var = ::Kitchen::Terraform::CommandFlag::Var.new arguments: config.fetch(:variables)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# @return [String] the command with flags.
|
|
46
|
-
def to_s
|
|
47
|
-
"validate " \
|
|
48
|
-
"#{color} " \
|
|
49
|
-
"#{var} " \
|
|
50
|
-
"#{var_file}"
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
private
|
|
54
|
-
|
|
55
|
-
attr_accessor(
|
|
56
|
-
:color,
|
|
57
|
-
:var_file,
|
|
58
|
-
:var,
|
|
59
|
-
)
|
|
20
|
+
# Validate is the namespace for Terraform Validate commands.
|
|
21
|
+
module Validate
|
|
60
22
|
end
|
|
61
23
|
end
|
|
62
24
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2016-2019 New Context, 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/command_flag/color"
|
|
18
|
+
require "shellwords"
|
|
19
|
+
|
|
20
|
+
module Kitchen
|
|
21
|
+
module Terraform
|
|
22
|
+
module Command
|
|
23
|
+
module Validate
|
|
24
|
+
# The root module is validated by running a command like the following example:
|
|
25
|
+
# terraform validate \
|
|
26
|
+
# [-no-color] \
|
|
27
|
+
# <directory>
|
|
28
|
+
class PostZeroFifteenZero
|
|
29
|
+
# #initialize prepares a new instance of the class.
|
|
30
|
+
#
|
|
31
|
+
# @param config [Hash] the configuration of the driver.
|
|
32
|
+
# @option config [Boolean] :color a toggle of colored output from the Terraform client.
|
|
33
|
+
# @return [Kitchen::Terraform::Command::Validate]
|
|
34
|
+
def initialize(config:)
|
|
35
|
+
self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [String] the command with flags.
|
|
39
|
+
def to_s
|
|
40
|
+
"validate " \
|
|
41
|
+
"#{color}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
attr_accessor :color
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|