module Kitchen::Terraform::Driver
Driver
is the namespace for driver strategies.
Public Instance Methods
define_options()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 132 def define_options self.options = { cwd: complete_config.fetch(:root_module_directory), timeout: complete_config.fetch(:command_timeout), } self.destroy_options = options.merge( environment: { "LC_ALL" => nil, "TF_IN_AUTOMATION" => "true", "TF_WARN_OUTPUT_ERRORS" => "true" }, ) end
delete_test_workspace()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 149 def delete_test_workspace logger.warn "Deleting the #{workspace_name} Terraform workspace..." command_executor.run command: workspace_delete_test, options: options do |standard_output| end logger.warn "Finished deleting the #{workspace_name} Terraform workspace." end
destroy_infrastructure()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 142 def destroy_infrastructure logger.warn "Destroying the Terraform-managed infrastructure..." command_executor.run command: destroy, options: destroy_options do |standard_output| end logger.warn "Finished destroying the Terraform-managed infrastructure." end
execute_workflow()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 156 def execute_workflow initialize_directory select_or_create_test_workspace destroy_infrastructure select_default_workspace delete_test_workspace end
initialize_directory()
click to toggle source
# File lib/kitchen/terraform/driver/create.rb, line 115 def initialize_directory logger.warn "Initializing the Terraform working directory..." command_executor.run( command: ::Kitchen::Terraform::Command::InitFactory.new(version: client_version) .build(config: complete_config), options: options, ) do |standard_output| end logger.warn "Finished initializing the Terraform working directory." end
read_client_version()
click to toggle source
# File lib/kitchen/terraform/driver/create.rb, line 126 def read_client_version logger.warn "Reading the Terraform client version..." command_executor.run command: version, options: options do |standard_output| self.client_version = ::Gem::Version.new standard_output.slice /Terraform v(\d+\.\d+\.\d+)/, 1 end logger.warn "Finished reading the Terraform client version." end
select_default_workspace()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 183 def select_default_workspace logger.warn "Selecting the default Terraform workspace..." command_executor.run command: workspace_select_default, options: options do |standard_output| end logger.warn "Finished selecting the default Terraform workspace." end
select_or_create_test_workspace()
click to toggle source
# File lib/kitchen/terraform/driver/destroy.rb, line 190 def select_or_create_test_workspace logger.warn "Selecting the #{workspace_name} Terraform workspace..." command_executor.run command: workspace_select_test, options: options do |standard_output| end logger.warn "Finished selecting the #{workspace_name} Terraform workspace." rescue ::Kitchen::TransientFailure create_test_workspace end
select_workspace()
click to toggle source
# File lib/kitchen/terraform/driver/create.rb, line 134 def select_workspace logger.warn "Selecting the #{workspace_name} Terraform workspace..." command_executor.run command: workspace_select, options: options do |standard_output| end logger.warn "Finished selecting the #{workspace_name} Terraform workspace." end