Class: Kitchen::Terraform::Command::Validate::PreZeroFifteenZero

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb

Overview

The root module is validated by running a command like the following example:

terraform validate \
  [-no-color] \
  [-var=<variables.first>...] \
  [-var-file=<variable_files.first>...] \
  <directory>

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Kitchen::Terraform::Command::Validate

#initialize prepares a new instance of the class.

Parameters:

  • config (Hash)

    the configuration of the driver.

Options Hash (config:):

  • :color (Boolean)

    a toggle of colored output from the Terraform client.

  • :variable_files (Array<String>)

    a list of pathnames of Terraform variable files to evaluate.

  • :variables (Hash{String=>String})

    a mapping of Terraform variables to evaluate.



40
41
42
43
44
# File 'lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb', line 40

def initialize(config:)
  self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color)
  self.var_file = ::Kitchen::Terraform::CommandFlag::VarFile.new pathnames: config.fetch(:variable_files)
  self.var = ::Kitchen::Terraform::CommandFlag::Var.new arguments: config.fetch(:variables)
end

Instance Method Details

#to_sString

Returns the command with flags.

Returns:

  • (String)

    the command with flags.



47
48
49
50
51
52
# File 'lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero.rb', line 47

def to_s
  "validate " \
  "#{color} " \
  "#{var} " \
  "#{var_file}"
end