Module: Kitchen::Terraform::ConfigAttribute::State Abstract

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

Overview

This module is abstract.

It must be included by a plugin class in order to be used.

The :state configuration attribute is an optianl string which contains the path to the Terraform state file which will be generated and managed.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Kitchen::Terraform::ConfigAttributeCacher

define_cache, extended

Class Method Details

.included(plugin_class) ⇒ void

This method returns an undefined value.

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.



33
34
35
36
37
38
39
40
# File 'lib/kitchen/terraform/config_attribute/state.rb', line 33

def self.included(plugin_class)
  ::Kitchen::Terraform::FilePathConfigAttributeDefiner
    .new(
      attribute: self,
      schema: ::Kitchen::Terraform::ConfigSchemas::String
    )
    .define plugin_class: plugin_class
end

.to_sym::Symbol

Returns the symbol corresponding to this attribute.

Returns:

  • (::Symbol)

    the symbol corresponding to this attribute.



43
44
45
# File 'lib/kitchen/terraform/config_attribute/state.rb', line 43

def self.to_sym
  :state
end

Instance Method Details

#config_state_default_value::String

The path to a file under the kitchen-terraform suite directory.

Returns:

  • (::String)

    “.kitchen/kitchen-terraform/<suite_name>/terraform.tfstate”.



52
53
54
# File 'lib/kitchen/terraform/config_attribute/state.rb', line 52

def config_state_default_value
  instance_pathname filename: "terraform.tfstate"
end