Class: Kitchen::Terraform::Provisioner::Converge
- Inherits:
-
Object
- Object
- Kitchen::Terraform::Provisioner::Converge
- Defined in:
- lib/kitchen/terraform/provisioner/converge.rb
Overview
A Test Kitchen instance is converged through the following steps.
Selecting the Test Terraform Workspace
The workspace is selected by running a command like the following example:
terraform workspace select <name>
Updating the Terraform Dependency Modules
The dependency modules are updated by running a command like the following example:
terraform get -update <directory>
Validating the Terraform Root Module
Terraform >= 0.15.0
The root module is validated by running a command like the following example:
terraform validate \
[-no-color] \
<directory>
Terraform < 0.15.0
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>
Applying the Terraform State Changes
The state changes are applied by running a command like the following example:
terraform apply\
-lock=<lock> \
-lock-timeout=<lock_timeout>s \
-input=false \
-auto-approve=true \
[-no-color] \
-parallelism=<parallelism> \
-refresh=true \
[-var=<variables.first>...] \
[-var-file=<variable_files.first>...] \
<directory>
Retrieving the Terraform Output
The outputs are retrieved by running a command like the following example:
terraform output -json
Instance Method Summary collapse
-
#call(state:) ⇒ self
#call executes the action.
-
#initialize(config:, connection:, debug_connection:, logger:, version_requirement:, workspace_name:) ⇒ Kitchen::Terraform::Driver::Converge
constructor
#initialize prepares a new instance of the class.
Constructor Details
#initialize(config:, connection:, debug_connection:, logger:, version_requirement:, workspace_name:) ⇒ Kitchen::Terraform::Driver::Converge
#initialize prepares a new instance of the class.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/kitchen/terraform/provisioner/converge.rb', line 87 def initialize(config:, connection:, debug_connection:, logger:, version_requirement:, workspace_name:) self.complete_config = config.to_hash.merge workspace_name: workspace_name self.client_version = ::Gem::Version.new "0.0.0" self.connection = connection self.debug_connection = debug_connection self.logger = logger self.workspace_name = workspace_name initialize_commands initialize_outputs_handlers self.variables = complete_config.fetch :variables self.variables_manager = ::Kitchen::Terraform::VariablesManager.new self.verify_version = ::Kitchen::Terraform::VerifyVersion.new( config: complete_config, logger: logger, version_requirement: version_requirement, ) end |
Instance Method Details
#call(state:) ⇒ self
#call executes the action.
68 69 70 71 72 73 74 75 |
# File 'lib/kitchen/terraform/provisioner/converge.rb', line 68 def call(state:) read_client_version verify_version.call version: client_version execute_workflow save_variables_and_outputs state: state self end |