Class: Kitchen::Terraform::ConfigAttribute

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/config_attribute.rb,
lib/kitchen/terraform/config_attribute/lock.rb,
lib/kitchen/terraform/config_attribute/color.rb,
lib/kitchen/terraform/config_attribute/client.rb,
lib/kitchen/terraform/config_attribute/systems.rb,
lib/kitchen/terraform/config_attribute/fail_fast.rb,
lib/kitchen/terraform/config_attribute/variables.rb,
lib/kitchen/terraform/config_attribute/parallelism.rb,
lib/kitchen/terraform/config_attribute/lock_timeout.rb,
lib/kitchen/terraform/config_attribute/variable_files.rb,
lib/kitchen/terraform/config_attribute/verify_version.rb,
lib/kitchen/terraform/config_attribute/command_timeout.rb,
lib/kitchen/terraform/config_attribute/plugin_directory.rb,
lib/kitchen/terraform/config_attribute/root_module_directory.rb,
lib/kitchen/terraform/config_attribute/backend_configurations.rb

Overview

ConfigAttribute is the class of objects which apply the behaviour of a configuration attribute to a module which must be included by a plugin class.

Defined Under Namespace

Modules: BackendConfigurations, Client, Color, CommandTimeout, FailFast, Lock, LockTimeout, Parallelism, PluginDirectory, RootModuleDirectory, Systems, VariableFiles, Variables, VerifyVersion

Instance Method Summary collapse

Constructor Details

#initialize(attribute:, default_value:, schema:) ⇒ ConfigAttribute

#initialize prepares a new instance of the class.

Parameters:

  • attribute (Symbol)

    the name of the attribute.

  • default_value (Proc)

    a block which returns the default value for the attribute.

  • schema (Dry::Validation::Schema)

    the schema of the attribute.



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

def initialize(attribute:, default_value:, schema:)
  self.attribute = attribute
  self.default_value = default_value
  self.schema = schema
end

Instance Method Details

#apply(config_attribute:) ⇒ self

#apply applies the configuration attribute behaviour to a module.

Parameters:

  • config_attribute (Module)

    a module.

Returns:

  • (self)


29
30
31
32
33
34
35
36
# File 'lib/kitchen/terraform/config_attribute.rb', line 29

def apply(config_attribute:)
  self.config_attribute = config_attribute
  define_singleton_included
  define_singleton_to_sym
  define_config_attribute_default_value

  self
end