Class: Kitchen::Terraform::Command::Destroy
- Inherits:
-
Object
- Object
- Kitchen::Terraform::Command::Destroy
- Defined in:
- lib/kitchen/terraform/command/destroy.rb
Overview
The state is destroyed by running a command like the following example:
terraform destroy \
-auto-approve \
-lock=<lock> \
-lock-timeout=<lock_timeout>s \
-input=false \
[-no-color] \
-parallelism=<parallelism> \
-refresh=true \
[-var=<variables.first>...] \
[-var-file=<variable_files.first>...] \
<root_module_directory>
Instance Method Summary collapse
-
#initialize(config:) ⇒ Kitchen::Terraform::Command::Destroy
constructor
#initialize prepares a new instance of the class.
-
#to_s ⇒ String
The command with flags.
Constructor Details
#initialize(config:) ⇒ Kitchen::Terraform::Command::Destroy
#initialize prepares a new instance of the class.
51 52 53 54 55 56 57 58 |
# File 'lib/kitchen/terraform/command/destroy.rb', line 51 def initialize(config:) self.color = ::Kitchen::Terraform::CommandFlag::Color.new enabled: config.fetch(:color) self.lock = config.fetch :lock self.lock_timeout = ::Kitchen::Terraform::CommandFlag::LockTimeout.new duration: config.fetch(:lock_timeout) self.parallelism = config.fetch :parallelism self.var_file = ::Kitchen::Terraform::CommandFlag::VarFile.new pathnames: config.fetch(:variable_files) self.var = ::Kitchen::Terraform::CommandFlag::Var.new arguments: config.fetch(:variables) end |
Instance Method Details
#to_s ⇒ String
Returns the command with flags.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/kitchen/terraform/command/destroy.rb', line 61 def to_s "destroy " \ "-auto-approve " \ "-lock=#{lock} " \ "#{lock_timeout} " \ "-input=false " \ "#{color} " \ "-parallelism=#{parallelism} " \ "-refresh=true " \ "#{var} " \ "#{var_file}" end |