Class: Kitchen::Terraform::Command::Apply
- Inherits:
-
Object
- Object
- Kitchen::Terraform::Command::Apply
- Defined in:
- lib/kitchen/terraform/command/apply.rb
Overview
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>
Instance Method Summary collapse
-
#initialize(config:) ⇒ Kitchen::Terraform::Command::Apply
constructor
#initialize prepares a new instance of the class.
-
#to_s ⇒ String
The command with flags.
Constructor Details
#initialize(config:) ⇒ Kitchen::Terraform::Command::Apply
#initialize prepares a new instance of the class.
51 52 53 54 55 56 57 58 |
# File 'lib/kitchen/terraform/command/apply.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/apply.rb', line 61 def to_s "apply " \ "-auto-approve " \ "-lock=#{lock} " \ "#{lock_timeout} " \ "-input=false " \ "#{color} " \ "-parallelism=#{parallelism} " \ "-refresh=true " \ "#{var} " \ "#{var_file}" end |