class Kitchen::Provisioner::Terraform

The provisioner applies changes to the Terraform state based on the configuration of the root module.

Commands

The following command-line actions are provided by the provisioner.

kitchen converge

{include:Kitchen::Terraform::Provisioner::Converge}

Configuration Attributes

The provisioner has no configuration attributes, but the provisioner mapping must be declared with the plugin name within the {kitchen.ci/docs/getting-started/kitchen-yml Test Kitchen configuration file}.

provisioner:
  name: terraform

Ruby Interface

This class implements the interface of Kitchen::Configurable which requires the following Reek suppressions: :reek: MissingSafeMethod { exclude: [ finalize_config! ] }

@example Describe the converge command

kitchen help converge

@example Converge a Test Kitchen instance

kitchen converge default-ubuntu

@version 2

Constants

UNSUPPORTED_BASE_ATTRIBUTES

UNSUPPORTED_BASE_ATTRIBUTES is the list of attributes inherited from Kitchen::Provisioner::Base which are not supported by Kitchen::Provisioner::Terraform.

Attributes

action_failed[RW]
converge_strategy[RW]

Public Instance Methods

call(state) click to toggle source

Converges a Test Kitchen instance.

@param state [Hash] the mutable instance and provisioner state. @raise [Kitchen::ActionFailed] if the result of the action is a failure.

# File lib/kitchen/provisioner/terraform.rb, line 82
def call(state)
  converge_strategy.call state: state
rescue => error
  action_failed.call message: error.message
end
finalize_config!(instance) click to toggle source

finalize_config! invokes the super implementation and then initializes the strategy.

@param instance [Kitchen::Instance] an associated instance. @raise [Kitchen::ClientError] if the instance is nil. @return [self] @see Kitchen::Configurable#finalize_config!

# File lib/kitchen/provisioner/terraform.rb, line 94
def finalize_config!(instance)
  super instance
  self.action_failed = ::Kitchen::Terraform::Raise::ActionFailed.new logger: logger
  self.converge_strategy = ::Kitchen::Terraform::Provisioner::Converge.new(
    config: instance.driver.send(:config),
    logger: logger,
    version_requirement: version_requirement,
    workspace_name: workspace_name,
  )

  self
end