class Kitchen::Terraform::OutputsManager
OutputsManager
manages Terraform
outputs in the Kitchen
instance state.
Attributes
state_key[RW]
Public Class Methods
new()
click to toggle source
initialize prepares a new instance of the class.
@return [Kitchen::Terraform::OutputsManager]
# File lib/kitchen/terraform/outputs_manager.rb, line 26 def initialize self.state_key = :kitchen_terraform_outputs end
Public Instance Methods
load(outputs:, state:)
click to toggle source
load
reads the Terraform
outputs from the Kitchen
instance state and writes them to a container.
@param outputs [Hash] the container to which the Terraform
outputs will be written. @param state [Hash] the Kitchen
instance state from which the Terraform
outputs will be read. @return [self]
# File lib/kitchen/terraform/outputs_manager.rb, line 35 def load(outputs:, state:) outputs.replace state.fetch state_key self rescue ::KeyError raise( ::Kitchen::ClientError, "Reading the Terraform output variables from the Kitchen instance state failed due to the absence of the " \ "'#{state_key}' key. This error could indicate that the Kitchen-Terraform provisioner plugin was not used " \ "to converge the Kitchen instance." ) end
save(outputs:, state:)
click to toggle source
save
reads the Terraform
outputs from container and writes them to the Kitchen
instance state.
@param outputs [Hash] the container from which the Terraform
outputs will be read. @param state [Hash] the Kitchen
instance state to which the Terraform
outputs will be written. @return [self]
# File lib/kitchen/terraform/outputs_manager.rb, line 53 def save(outputs:, state:) state.store state_key, outputs.dup self end