Module: Kitchen::Terraform::ConfigAttribute::Client

Extended by:
Kitchen::Terraform::ConfigAttributeCacher
Included in:
Driver::Terraform, Kitchen::Transport::Terraform
Defined in:
lib/kitchen/terraform/config_attribute/client.rb

Overview

This attribute contains the pathname of the Terraform client to be used by Kitchen-Terraform.

If the value is not an absolute pathname or a relative pathname then Kitchen-Terraform will attempt to find the value in the directories of the ) PATH.

The pathname of any executable file which implements the interfaces of the following Terraform client commands may be specified: apply; destroy; get; init; validate; workspace.

Type

Scalar

Required

False

Default

terraform

Example

client: /usr/local/bin/terraform

Example

client: ./bin/terraform

Example

client: terraform

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Kitchen::Terraform::ConfigAttributeCacher

define_cache, extended

Class Method Details

.included(plugin_class) ⇒ self

.included is a callback to define the configuration attribute which is invoked when this module is included in a plugin class.

Parameters:

  • plugin_class (Kitchen::Configurable)

    A plugin class.

Returns:

  • (self)


47
48
49
50
51
52
53
54
55
56
57
# File 'lib/kitchen/terraform/config_attribute/client.rb', line 47

def included(plugin_class)
  ::Kitchen::Terraform::ConfigAttributeDefiner.new(
    attribute: self,
    schema: ::Kitchen::Terraform::ConfigAttributeContract::String.new,
  ).define plugin_class: plugin_class
  plugin_class.expand_path_for to_sym do |plugin|
    !::TTY::Which.exist? plugin[to_sym]
  end

  self
end

.to_symSymbol

Returns the symbol corresponding to this attribute.

Returns:

  • (Symbol)

    the symbol corresponding to this attribute.



60
61
62
# File 'lib/kitchen/terraform/config_attribute/client.rb', line 60

def to_sym
  :client
end

Instance Method Details

#config_client_default_valueString

Returns </code>“terraform”</code>.

Returns:

  • (String)

    </code>“terraform”</code>



68
69
70
# File 'lib/kitchen/terraform/config_attribute/client.rb', line 68

def config_client_default_value
  "terraform"
end

#doctor_config_clientBoolean

#doctor_config_client validates the client configuration.

Returns:

  • (Boolean)

    true if any errors are found; false if no errors are found.



75
76
77
78
79
80
81
82
83
84
# File 'lib/kitchen/terraform/config_attribute/client.rb', line 75

def doctor_config_client
  errors = false

  if !::TTY::Which.exist? config_client
    errors = true
    logger.error "client '#{config_client}' is not executable or does not exist"
  end

  errors
end