Class: TerraformWrapper::Tasks::Upgrade

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Shared::Logging
Defined in:
lib/terraform-wrapper/tasks/upgrade.rb

Instance Method Summary collapse

Methods included from Shared::Logging

configure_logger_for, logger_for

Constructor Details

#initialize(binary:, code:) {|_self| ... } ⇒ Upgrade

Returns a new instance of Upgrade.

Yields:

  • (_self)

Yield Parameters:



21
22
23
24
25
26
27
28
# File 'lib/terraform-wrapper/tasks/upgrade.rb', line 21

def initialize(binary:, code:)
  @binary = binary
  @code   = code

  yield self if block_given?

  upgrade_task
end

Instance Method Details

#upgrade_taskObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/terraform-wrapper/tasks/upgrade.rb', line 32

def upgrade_task
  desc 'Upgrades the Terraform infrastructure component modules, providers and lock file.'
  task upgrade: [:binary] do |_t, _args|
    runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code)

    logger.info("Upgrading Terraform component: #{@code.name}...")

    runner.upgrade
  end
end